-1

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 ?

  • 6
    What version are you running on Ubuntu? Did you install it from apt, perchance? – Majenko Sep 25 '18 at 12:38
  • 1
    avr-gcc automatically called on arduino-builder binary, let i see what the output of your console log after your compile/upload sketch file and what your the steps tried? – abu-ahmed al-khatiri Sep 25 '18 at 13:34
  • 2
    Abu-Ahmed has the right idea on how we can help you. It would be nice if you reproduced the problem on your Ubuntu machine and gave us the exception that it's catching (verbatim). It sounds like you're missing some appropriate libraries. If you did a simple apt-get install arduino on 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

1 Answers1

2

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.

enter image description here

Hope you can get it.