Skip to main content

Questions tagged [compiler]

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

Filter by
Sorted by
Tagged with
-1 votes
2 answers
76 views

Removing the L from F_CPU in assembly

I am developing a mixed c++ /asm project. In the asm I am using F_CPU to do some busy waiting as follows. However, by default, the F_CPU is defined with a trailing L (for long). The asm is not able to ...
Fabio Dalla Libera's user avatar
2 votes
1 answer
189 views

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 ...
Ramanewbie's user avatar
1 vote
1 answer
1k views

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 ...
Hassan Daoud's user avatar
0 votes
1 answer
111 views

Global array doesn't get assigned the space it would take up in memory

I have this sketch: const uint32_t len = 65536; uint8_t arr[len]; void setup() {} void loop() {} The length of the array should fit into the dynamic memory. However, when I compile the sketch it ...
LukasFun's user avatar
  • 295
1 vote
0 answers
372 views

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 ...
adrianton3's user avatar
0 votes
1 answer
79 views

Problems with compiling more then one sketch in the Arduino IDE

I found this ESP8266-MQTT program on Github. How can I compile this thing with the Arduino IDE? I only can open one sketch at a time. If I try to compile this then parts of the program are missing for ...
Fred Mustermann's user avatar
2 votes
1 answer
3k views

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 ...
Ben L's user avatar
  • 23
2 votes
1 answer
860 views

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 ...
Zanshin's user avatar
  • 61
5 votes
3 answers
2k views

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 ...
Supragy Mishra's user avatar
4 votes
1 answer
516 views

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 ...
WildCat's user avatar
  • 323
1 vote
0 answers
200 views

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 ...
solutionhacker's user avatar
1 vote
0 answers
88 views

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 <filename> works well with catch2, but I obviously ...
Nathan Almeida's user avatar
1 vote
2 answers
107 views

Runtime compilation

I want to compile a sketch on Arduino Uno, while Arduino is running and not connected to anything else, and then run the compiled sketch automatically. Is this feasible? How?
user65440's user avatar
0 votes
1 answer
3k views

Can't use uint16_t in library

I wonder why the following minimal example sketch doesn't compile (unknown type name 'uint16_t'): sketch_does_not_compile.ino: #include "myheader.h" void setup() { char a[]="hello ...
Sim Son's user avatar
  • 1,869
1 vote
0 answers
58 views

default in switch doesn't appear to execute

I have a situation where the default case in my switch statement doesn't appear to execute as expected. I wonder if there is some subtlety I'm missing here? Given the following enum: enum ...
Tim Long's user avatar
  • 305
0 votes
1 answer
75 views

Weird problem with arduino

I wrote the code below and the result is not what I expected at all! I'm not sure why it's happening! void setup() { // put your setup code here, to run once: Serial.begin(9600); } const uint8_t ...
OM222O's user avatar
  • 199
3 votes
3 answers
4k views

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

char webpage[] PROGMEM = R"=====( <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/svg.js/2.6.6/svg.min.js"></script> </head> <body> &...
Ho Chung Law's user avatar
-1 votes
3 answers
2k views

Is there an open source compiler for Arduino Sketch codes?

I am working on a web app to program some nodeMCU devices that were flashed with the arduinoOTA library. http://esp8266.github.io/Arduino/versions/2.0.0/doc/ota_updates/ota_updates.html I tried the ...
Ho Chung Law's user avatar
1 vote
0 answers
52 views

Are there documented Arduino class or file name restrictions?

I ran into a strange problem were the compiler could not find a header file that I knew existed. The problem was I created a class called ArduinoEvent and put it in ArduinoEvent.hpp, but when I ...
nPn's user avatar
  • 154
1 vote
1 answer
957 views

Pass a char array to a function that uses File as parameter

I am in serious need for help here. I have a rather small function that get's the number of files from within a given directory. Now, the directory name (that is the path) is stored in a char array ...
siliconchris's user avatar
0 votes
1 answer
6k views

What is causing this 'narrowing conversion' warning?

Because I'm still figuring out 'Arduino C' I leave all warnings on. Recently I got this one: narrowing conversion of '(int)(((unsigned char)bx_0) | ((unsigned char)bx_1))' from 'int' to 'const byte.....
Jim Mack's user avatar
  • 235
0 votes
1 answer
701 views

Error Compiling to Board Teensy LC

I wrote a simple switch program using a teensy LC and transistors, but the Arduino compiler will not compile for the Teensy LC. And not for just my program, but any program, including the example ...
Blake H's user avatar
1 vote
2 answers
6k views

Duplicate libraries while compiling for ESP32 in the Arduino IDE

I have just added the ESP32 toolchain to the Arduino IDE (v1.8.0) on Windows 10. To get the IDE to allow me to select ESP32 chips I had to place the Espressif folder in "D:\Program Files(x86)\Arduino\...
Code Gorilla's user avatar
  • 5,637
5 votes
1 answer
20k views

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 <motor.h> void setup() { motorInitialize(); } void ...
Kyle Marino's user avatar
1 vote
1 answer
915 views

Compiling source with Arduino.h with avr-g++

How should I include the Arduino libraries when I'm compiling from the the command line? I tried to do it like this: avr-g++ -g -Os -Wall -mcall-prologues -mmcu=atmega328p -fno-exceptions -o blink....
Vasil Kalchev's user avatar
1 vote
3 answers
1k views

Arduino constant vs Microchip PIC constant

2.2 THE BASICS OF C PROGRAMMING LANGUAGE book is has like this, CONSTANTS A constant is a number or a character having fixed value that cannot be changed during program execution. Unlike variables, ...
user119o's user avatar
  • 225
3 votes
1 answer
2k views

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: ...
sergiu reznicencu's user avatar
0 votes
1 answer
65 views

smaller program bigger sketch

I'm working on a program composed by several classes. I reduced the size of a single class of (more or less) one hundred lines (4kb of stuff) I expected a smaller sketch but surprisingly it is ...
alejho's user avatar
  • 11
1 vote
0 answers
263 views

Using SlickEdit to compile Arduino files

I would like to compile my Arduino sketches in SlickEdit. I have turned on the verbose compile output in the standard IDE and I can see the compile and switches, but it doesn't appear that there is a ...
Rich Maes's user avatar
  • 243
5 votes
3 answers
13k views

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 ...
Rich Maes's user avatar
  • 243
1 vote
2 answers
260 views

Why are some letters reserved?

I wrote a function that takes characters and noticed that the Arduino Compiler treated some characters like system-reserved, and other like functions, and a few just like characters. Lowercase doesn't ...
j0h's user avatar
  • 892
1 vote
1 answer
188 views

Compiling Error

I am trying to compile this code on arduino IDE...It showing error code is #include <IRremote.h> int RECV_PIN = 6; int led = 12;//1FE50AF int led1 = 10;//1FED827 int led2 = 9; //1FEF807 int ...
Prayuktibid's user avatar
1 vote
1 answer
171 views

I swear this worked yesterday!! - mysterious compiler error

I thought I finally had this working yesterday, the code compiled, and executed on the arduino, there were however some small quirks but today I went to fix a small timing issue, but got the following ...
user26383's user avatar
0 votes
2 answers
18k views

GCC msg "note: in definition of macro 'max'" error message

I'm using the ATtiny x5 series board, compiling my project (.cpp.ino file). Whenever I use the max(a,b) macro, I receive this message: "C:\Documents and Settings\<user>\Local Settings\...
HiTechHiTouch's user avatar
0 votes
1 answer
3k views

Getting "Undefined reference to vtable for {classname}

I have a large collection of libraries that compile correctly but won't link. I am using Visual Micro for Visual Studio 2015. Here is the complete collection of error messages: CommandPattern3.cpp.o:...
Bob Jones's user avatar
  • 131
1 vote
1 answer
1k views

Force compiler to execute instructions sequentially?

Is there a way to force the Arduino compiler to compile individual commands sequentially? Looking at the disassembly, lines of the assembly code for different C/Arduino commands are mixed. I was ...
Alexandra's user avatar
2 votes
2 answers
2k views

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 ...
John Burger's user avatar
  • 1,875