Questions tagged [compile]

To compile is to convert the code for a sketch into machine readable files that are uploaded to the Arduino. This tag is mostly used for the space and footprint of the files uploaded to the Arduino.

Filter by
Sorted by
Tagged with
43 votes
2 answers
41k views

Warning when verifying sketch with VS code

I use Visual Studio Code to develop for arduino which uses Arduino Studio installed files and needs the installation to work. This works very well. Annoying is that when verifying a sketch it takes ...
Uwe Hafner's user avatar
30 votes
6 answers
56k views

How to compile, upload and monitor via the Linux command line?

Interfacing an Arduino Uno (uploading etc.) with the Arduino IDE (using the Fedora package) works fine under Fedora 21. But I rather want to use vim + make + vim-quickfix-mode etc. How can I do that?...
maxschlepzig's user avatar
22 votes
2 answers
18k views

Why can't I declare a class in another tab in Arduino IDE?

I wanted to move some of my code out into a second tab in the Arduino IDE, to keep things better organised. At first, I only tried moving a function, and it seemed to work fine. I could call the ...
Peter Bloomfield's user avatar
15 votes
1 answer
38k views

Arduino IDE #ifdef

I use my Arduino IDE to either upload my sketch to a Arduino or ATTiny or ATmega328. As you know each device can have a different pinout. Does the Arduino compiler support ifdef, depending on the ...
PhillyNJ's user avatar
  • 1,168
15 votes
1 answer
313 views

Is there a preprocessor constant for memory size

I would like my compiles to exclude some code depending upon the flash/program space available. To be used in the demo code of a library I support. Whereas my current solution is to use a #ifdef of ...
mpflaga's user avatar
  • 2,513
14 votes
4 answers
16k views

Why do sketches take up so much space and memory?

When I compile this sketch for the Yún: int led = 7; void setup() { pinMode(led, OUTPUT); } void loop() { digitalWrite(led, HIGH); } I get: Sketch uses 5,098 bytes (17%)...
hichris123's user avatar
12 votes
2 answers
11k views

Will a .ino Arduino Sketch compile directly on GCC-AVR?

Okay, we all have seen those questions all over the web such as Arduino v.s. C++, or other similar questions. And a vast majority of the answers do not even touch compilation differences other than ...
RedDogAlpha's user avatar
10 votes
1 answer
4k views

Setting timer3 in CTC mode - conflict with servo library

I would like to set up a timer in order to call a function 800 times per second. I'm using the Arduino Mega and Timer3 with a prescaler of 1024. To choose the prescaler factor I've considered the ...
UserK's user avatar
  • 559
8 votes
2 answers
6k views

Is it possible to run a binary from EEPROM?

Say I wrote a compiled sketch to EEPROM then read it. Could I run the program from EEPROM? I guess the question is: Can an Arduino run software not in flash memory in the middle of executing the ...
Piper McCorkle's user avatar
8 votes
2 answers
15k views

Basic makefile for avr-gcc

I would like to make a makefile for compiling c programs for the arduino. I am somewhat familiar with make but have never used it with avr-gcc. What is the simplest way I could put the commands below ...
connorwstein's user avatar
8 votes
3 answers
6k views

Manchester Library Won't Compile for Attiny85

I am creating a wireless sensor using an Attiny85. I want to send the data to an arduino uno, so I purchased the 315mhz rf link kit from spark fun. Since the Attiny85 does not have a TX I decided to ...
Joel's user avatar
  • 523
7 votes
4 answers
35k views

How to add hysteresis to threshold values?

This code compares the analog input value against two thresholds, having three voltage regions. Then it will turn on an LED according to what region the read voltage is in. The problem is that when ...
Andy's user avatar
  • 103
7 votes
2 answers
9k views

Is there a way to upload precompiled code to an arduino?

My company is developing a programmable remote control car which is driven by an Arduino Nano. We would like a way for the user to install software updates to the Arduino, but we don't want to give ...
TheIronKnuckle's user avatar
7 votes
1 answer
4k views

Warning Arduino CMakeLists "Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES"

I'm trying to build an Arduino example without using its IDE. My OS is Windows 8.1 and I'm using the last version of CMake (2.8.12.2) and MinGW (GNU Make 3.82.90). I downloaded the Arduino ...
fenix688's user avatar
  • 173
6 votes
6 answers
24k views

Compiling is slow

Compilation of even the simplest program (like Blink) is extremely slow, the progress bar often hangs halfway for nearly half a minute. Is this normal? I understand that not all computers are equally ...
Joris Groosman's user avatar
6 votes
1 answer
2k views

Can I compile c/c++ code on the linux part of the Arduino Yun?

Can I compile c/c++ code on the linux part of the Arduino Yun? How complete is the linux part of the Arduino Yun? Can I scp some c/c++ code onto the Atheros AR9331 chip compile it? Or must I first ...
Johan's user avatar
  • 415
6 votes
1 answer
743 views

Referencing local libraries from higher dir levels

How can I include libraries not contained in any direct subdirectories of a sketch, using the Arduino IDE? I want my project structure to look like this: Project └> MCUa └> MCUa.ino └> ...
Clausen's user avatar
  • 161
5 votes
6 answers
14k views

LCD 16*02 I2C shield only shows first character printed

I have an I2C LCD screen provided with a Sunfounder kit and certainly built by DFRobot or such a constructor (there is nothing written on the LCD), and an Arduino Uno R3 copy. My issue is when I use ...
AFract's user avatar
  • 193
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
5 votes
1 answer
971 views

How can I have code in a project that won't compile for Arduino?

I want to test the algorithms in my code without needing to send it to an actual Arduino board. I figured I could lay out my project like: project/ core.cpp # core algorithms core.h ...
Kevin Reid's user avatar
5 votes
2 answers
1k views

Does the compiler generate intermediate assembler?

My source files are *.ino, but after compilation there aren't any other files placed in the folder. Does the compiler generate intermediate assembler, and if so, where does it leave them? Or is the ...
Joris Groosman's user avatar
5 votes
1 answer
897 views

Cannot compile C++11 code via Makefile

I am building my Arduino project with a makefile: BOARD_TAG = uno ARDUINO_PORT = /dev/ttyACM0 USER_LIB_PATH = /home/prakhar/dev/alfred/arduino/libraries CPPFLAGS=-x c++ -std=c++11 -Wall -...
xyz's user avatar
  • 359
5 votes
1 answer
854 views

Library not found when using the arduino-cli command (although working with the Arduino IDE)

I have a sketch which I can upload without problem with the Arduino IDE. I installed the arduino-cli Version: 0.28.0 Commit: 06fb1909 Date: 2022-10-18T15:53:04Z. I want to compile and upload a code ...
ecjb's user avatar
  • 165
4 votes
3 answers
541 views

How to compile without adding the bootloader?

I'm using a standalone atmega328p with a 16MHz crystal. I'm programming it via avrdude on a raspberry pi, using the SPI and RESET pins. When I compile my program, this is what I see at the end of the ...
php_nub_qq's user avatar
4 votes
1 answer
403 views

Why does this code execute?

After experiencing failures of my Arduino projects due to low memory, I decided to do some research into it so I could understand better where the problems were. I eventually came to this code: void ...
user avatar
4 votes
2 answers
339 views

How to cut down size of imported DigiKeyboard library

I'm working on a project with a Digispark ATTiny85, that performs keystrokes using the DigisparkKeyboard library (https://github.com/digistump/DigisparkArduinoIntegration/tree/master/libraries/...
emma.makes's user avatar
4 votes
2 answers
2k views

Any way to include the text of a file inside a sketch, to make it shorter and neater?

I'm wondering if there is any way to include the text of a file into a sketch by using a single placeholder command, similar to the "#Include" command when using Server Side Includes on .shtml files. ...
Jerry's user avatar
  • 533
3 votes
1 answer
8k views

My Digispark board won't show up in Ports tab in Arduino IDE (OSX)

I bought a Digistump/Digispark board online and when i received it, I plugged it into my iMac to see if it works. I went to the apple in the top left corner and clicked "About this Mac". Then I ...
Sergei Glimis's user avatar
3 votes
2 answers
3k views

How to upload already compiled code when no changes were made?

How do I use the Arduino IDE to upload the last compiled code? I don't want to have to wait 2 minutes to upload compiled code when there are no changes. It's a big codebase, where I frequently make ...
steve antwan's user avatar
3 votes
1 answer
17k views

fatal error: avr/io.h: No such file or directory

I'm compiling a project on Due that was working correclty using UNO. I get this error : 'avr/io.h: No such file or directory'. Searching across the web, it seams I'm not the only one to get that error ...
snoob dogg's user avatar
3 votes
2 answers
2k views

Cannot find crtatmega328p

I have just installed the arduino IDE on my gentoo laptop. I then installed the toolchain with the following command: crossdev -s4 avr This does a stage 4 install of the toolchain, with all its ...
tensai's user avatar
  • 131
3 votes
2 answers
8k views

multiple definition of local variable in linking

I am trying to make my own library and it uses some local variables with the same name as some variables in ino. Compiler complains about it. I stripped it to (nonsence but simple) example mylib.h: #...
gilhad's user avatar
  • 1,420
3 votes
1 answer
188 views

Why don't these sketches produce a similar output?

I compiled the following two sketches with the compiler used by the Arduino IDE and ran them on an Arduino UNO (smd edition). I'm using: Arduino IDE v. 1.8.0 Arduino AVR Boards v. 1.6.20 1. void ...
noearchimede's user avatar
3 votes
1 answer
59k views

avrdude : stk500_get sync<> attempt 10 of 10 not in sync : resp=0x20 how do i get pass this error for ardunio uno board [duplicate]

When I first started with a bare minimum code. The compiler compiles the code, but when I try to upload, this is the error message I get: AVRDUDE: STK500_GETSYNC<> ATTEMPT 10 OF 10 NOT IN SYNC ...
mike harmon's user avatar
3 votes
2 answers
867 views

Arduino Upgrading from 1.0.6 to 1.6, code doesn't work anymore

I'm using Arduino UNO, and today I upgraded my IDE from 1.0.6 to 1.6, just to upgrade, nothing special. I got my libraries again but I got an error with a code that was working OK. The error was: ...
Claudiaum's user avatar
2 votes
5 answers
187 views

Break a big file into smaller files

I had a really big .ino file and I decided to break it down into sub-files. So I had the .ino file, the globals.h file and the functions.h file. I moved all the global vars and functions to their ...
user1584421's user avatar
  • 1,395
2 votes
3 answers
3k views

How to include <SPI.h> outside the .ino file

As I understand, Arduino IDE considers two paths for the libraries: first, "C:\Program Files\Arduino\libraries" and second, the "libraries" folder next to the schetchbook. I have a ...
Makan's user avatar
  • 239
2 votes
2 answers
1k views

How to properly understand verbose compiler error text? For beginner level

I'm an Arduino newbie, no background in C/C++, needing help to understand Arduino IDE verbose output about compiler errors. My searching failed to find suitable info - have I missed a relevant guide? ...
jules's user avatar
  • 75
2 votes
3 answers
195 views

Simple compiler design help: Variable length arrays in Arduino?

I'm trying to write a simple compiler in the Arduino language that I am making up for my lab. The compiler will have to be able to turn a string like this: "do command_one 3 times" into a data ...
Paul Terwilliger's user avatar
2 votes
2 answers
227 views

How to install the application + its configuration to many devices of the same kind? (ESP32)

Being the newbie in the Arduino area... Having more devices, how can I upload some configuration parameters after the code was uploaded? Is it possible? Situation: I have the simple application for ...
pepr's user avatar
  • 147
2 votes
1 answer
153 views

Conditional compilation depending on sizeof(double)

Is there a macro (#define ...) somewhere in the bowels of Arduino IDE or core header files which tells me at compile time(!), if the double data type for a given platform/board is a true double ...
Andy's user avatar
  • 123
2 votes
3 answers
2k views

Compiling code via terminal

How can I compile my code via terminal? I am working on a Chrome app that allows you to write, compile, and upload code to an Arduino, and I need to know this so I can use the command line compiler on ...
Jordan Baron's user avatar
2 votes
1 answer
5k views

Build arduino with windows command line

Can someone explain, step by step, along with all software I must use for using Windows command prompt to build an Arduino sketch (.ino file )? I've followed these steps but I can't.
Mela Mustika's user avatar
2 votes
1 answer
285 views

How to find out all #define used by arduino-cli in compile?

How to find out all #define used by arduino-cli in compile? I had seen something some time ago, but I cannot find it again. I think that it was some option somewhere, and the result was that the ...
gilhad's user avatar
  • 1,420
2 votes
3 answers
3k views

If statement comparing array to value list throws error

In my program I have the following lines of code: if (invest == {0, 1, 0, 0}) { //code } However, upon attempting to compile the code, I receive the following error: exit status 1 ...
Excelseo's user avatar
2 votes
1 answer
238 views

How can I make Arduino IDE use Atmel's provided toolchain? (Linux/Ubuntu)

I have an Arduino based board using ATmega168PB, but so far only Atmel's provided toolchain supports this microcontroller. I can download the toolchain from Atmel's website, but I am not sure how to ...
Rodrigo Da Silva Guerra's user avatar
2 votes
2 answers
1k views

How get assembler/preprocessed code for library

I am using https://github.com/sudar/Arduino-Makefile project with https://github.com/ladislas/Bare-Arduino-Project to compile my Arduino projects from Linux command line. I put as much as possible ...
gilhad's user avatar
  • 1,420
2 votes
1 answer
771 views

Compilation error using arduino-mk on arch Linux (undefined reference to __dso_handle)

I'm compiling a simple sketch that reads values from an analog input and activates a buzzer on a digital input. working on an Arduino uno. the sketch compiles and runs fine on windows and arch linux ...
NivPgir's user avatar
  • 23
2 votes
1 answer
480 views

Arduino Servo.h library returns error in compilation

I have a problem with Servo library. This is my (very short XD) "code": #include <Servo.h> void setup() { Servo.attach(9, 554, 2400); } void loop() { Servo.write(2000); } And it returns: ...
Nicolas's user avatar
  • 35
2 votes
1 answer
4k views

How to compile code for the Arduino Due?

I have set up Eclipse to compile for the Arduino Due using all the tools shipped with the Arduino IDE 1.5.6-r2. It compiles without errors, but when uploaded, the Arduino does nothing, and isn't ...
Friend of Kim's user avatar