I have some code that works fine on Windows but is giving me errors on Ubuntu. I noticed that while Windows is running the code using avr-gcc, Ubuntu is trying to make it run using avr-g++. Any functions not defined within void setup() comes up as "was not declared in this scope". Is there a way to force it to use avr-gcc ?
1 Answers
In my case, i would tell you compile/upload your sketch Arduino on Ubuntu 17.10 like my owned.
I have
- Wemos D1 MINI Board based ESP8266 chip.
- Define ttyUSB0 port like my Owned.
Before upload your sketch, you need Arduino Package for Ubuntu in Arduino Official Pages or if you have Arduino Package on your Aptitude Source list / PPA Repository of Arduino with following sudo apt-get install -y arduino. that's same to me.
After your Arduino Package installed, try to following commnand :
cd /path/installation/package/ //for change directory to Arduino Package
ARDUINO-DIR(pwd) //for make environment of Arduino directory
cd $HOME/Arduino/sketch/ //for change directory to your Arduino sketch
ls -l //for list all items in your folder
$ARDUINO-DIR/arduino --verify sketch.ino --board (board) --port (port) --verbose //for compile your sketch
$ARDUINO-DIR/arduino --upload sketch.ino --board (board) --port (port) --verbose //for upload your sketch
NOTE:
e.g --board esp8266:esp8266:d1_mini //for WemosD1Mini board or
e.g --board arduino:avr:uno //for ArduinoUNO board.
e.g --port /dev/ttyUSB0 or /dev/ttyACM0 //if your define ttyUSB0 or ttyACM0 port you have.
See Below to my verbose log appears a avr-gcc and a avr-g++ automatically called in arduino-builder binary to compile all my library defined.
Hope you can get it.
- 258
- 2
- 12
-
1I figured it out. Ubuntu arduino IDE was missing a library. Thank you for helping out – Just Curious Sep 26 '18 at 13:05
-
-
1@JustCurious which library? It would be nice if you posted the solution as an answer for future visitors. – RubberDuck Nov 25 '18 at 20:52

apt-get install arduinoon your console, then yeah I believe it's going to give you problems. Refer to Arduino's official page for Ubuntu installation. – Sep 25 '18 at 14:32