Questions tagged [compiler]

A compiler converts source code (C++, Java, etc) to machine code which is what the CPU runs.

A compiler is a program which converts human readable high level languages such as C/C++, Java, etc. to binary executable machine code which is run by the computer. An example of a compiler is gcc the Gnu C Compiler.

38 questions
6
votes
3 answers

Using Arduino as a standalone compiler

I mostly program in C/C++ so I conviniently have a GCC compiler for all my compilations. I was wondering if there is a special compiler for Arduino that can be used just like the GCC Compiler? Because just taking a .ino sketch and passing it to the…
6
votes
3 answers

Is there a constant for the Maximum Unsigned Long value in an Arduino compiler?

I am writing a timer function that uses the micros() function which generates a unsigned long value. To compensate for a roll over condition, I would like to use the maximum value for that variable type. I have a number, 4,294,967,295, but was…
Rich Maes
  • 253
  • 1
  • 3
  • 9
5
votes
1 answer

Multiple definition of "..." Compiler Error

I am creating a simple library to test how multiple files in an Arduino program works. I have three files. MotorController.ino: #include void setup() { motorInitialize(); } void loop() { } motor.cpp: #include "motor.h" void…
Kyle Marino
  • 53
  • 1
  • 1
  • 3
4
votes
1 answer

Does the compiled binary of a sketch include uncalled functions from a library?

I am writing a GUI using a TFT display and the Adafruit GFX library and its default font on Arduino Nano. I want to be memory efficient and I assumed that the 'optimise for size' default setting of the compiler would not compile and include all…
3
votes
3 answers

Arduino IDE c++ 11 raw string literal have issues with // in http://, complier thinks // is comment

char webpage[] PROGMEM = R"=====( )====="; I found a problem when using the raw string literal in…
Ho Chung Law
  • 91
  • 1
  • 9
3
votes
1 answer

Compiling error:passing as 'this' argument

I am trying to make a small keyboard class to handle two buttons(in the future >2) that are connected to my arduino UNO. The buttons being pressed are detected using interrupts. Here is the code: Timer class Timer{ private: uint32_t…
2
votes
0 answers

Unnecessary recompille after connection error

I sometimes multitask during a large compile (wifi, etc libraries) and don't get back in time to press the ESP32 upload button. If the connection times out, the IDE recompiles all the source again. Am I wrong that it should know there were no…
2
votes
1 answer

How to make the compiler ensure that local variables memory allocation won't cause any RAM overflow during execution?

Upon compiling a sketch using the Arduino IDE, a message like the following gets displayed in the console: Global variables use 1540 bytes (75%) of dynamic memory, leaving 508 bytes for local variables. Maximum is 2048 bytes. In addition, it seems…
Ramanewbie
  • 145
  • 3
2
votes
1 answer

ld.exe:linker_script.ld:138 cannot move location counter backwards | ArduinoFFT Error

Board: Arduino Nano 33 BLE Sense I'm pulling PCM data from an onboard microphone and running it through the arduinoFFT library (version 1.5.6) to obtain a spectrogram. Since the arduinoFFT library requires the data be an array of doubles, I've…
Ben L
  • 23
  • 1
  • 5
2
votes
1 answer

Arduino IDE - scope of the pre-processor "#define"

I'm creating an Arduino library and have 3 files - a "test.ino" program, and two library/class files: "testLibrary.h" and a "testLibrary.cpp". The library makes use of some hardware-specific resources such as registers and ISRs that depend upon…
Zanshin
  • 61
  • 6
2
votes
2 answers

What is the Arduino compiler's version of `__unused` for function parameters?

When I first started with the Arduino environment I noticed that it had File | Preferences | Compiler Warnings set to None, so I set it to All - and there were many, many warnings in the supplied libraries! So I quickly set it to None again - until…
John Burger
  • 1,885
  • 1
  • 14
  • 23
1
vote
1 answer

Compiler error: final link failed: bad value collect2.exe

I work With VS Code v:1.59.1. With extension vscode-arduino v:0.4.4 befor update of vscode. in version 1.58. all was ok. I can build and upload code for all mucrocontrollers. but after the update, I can build code for arduino uno. but when i build…
Hassan Daoud
  • 121
  • 4
1
vote
0 answers

Can data be stored in program storage space instead of dynamic memory?

I'm declaring an array at top level like so: constexpr byte a[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; // whatever data I'm referencing the array in such a way that it's not optimized away. When compiling this from the Arduino IDE it informs me that…
adrianton3
  • 111
  • 2
1
vote
0 answers

Error compiling to ESP32 using Arduino: Operand 2 of 'l32r' has out of range value

I was trying to follow this tutorial and ran into a problem compiling on the Arduino IDE with an ESP32 board. https://eloquentarduino.github.io/2019/12/how-to-do-gesture-identification-on-arduino/ I end up getting multiple lines of error from…
1
vote
0 answers

How to compile Arduino Framework with GNU

I'm wondering if it's possible to use GNU (g++) to compile a arduino Sketch. I wanna be able to unit test my code with catch2. g++ -std=c++11 works well with catch2, but I obviously does not recognize Arduino's framework (Strings, Serial…
1
2 3