-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 ?

3
  • 6
    What version are you running on Ubuntu? Did you install it from apt, perchance?
    – Majenko
    Commented Sep 25, 2018 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? Commented Sep 25, 2018 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.
    – user23244
    Commented Sep 25, 2018 at 14:32

1 Answer 1

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.

3
  • 1
    I figured it out. Ubuntu arduino IDE was missing a library. Thank you for helping out Commented Sep 26, 2018 at 13:05
  • @JustCurious glad to hear that. Commented Sep 26, 2018 at 13:08
  • 1
    @JustCurious which library? It would be nice if you posted the solution as an answer for future visitors.
    – RubberDuck
    Commented Nov 25, 2018 at 20:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.