this is a message when i couldn't upload my code on arduino from online ide
Error Code: /usr/local/bin/arduino-cli compile --fqbn arduino:avr:uno --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/125229010/build --build-path /tmp/arduino-build-4A14368B1CC0B95AACF0030F65371E70 /tmp/125229010/sketch_feb7b
Linking everything together...
/home/builder/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o /tmp/arduino-build-4A14368B1CC0B95AACF0030F65371E70/sketch_feb7b.ino.elf /tmp/arduino-build-4A14368B1CC0B95AACF0030F65371E70/sketch/sketch_feb7b.ino.cpp.o /tmp/arduino-build-4A14368B1CC0B95AACF0030F65371E70/../core/core_arduino_avr_uno_f1d675a35cb302d87396e400c56d2f7e.a -L/tmp/arduino-build-4A14368B1CC0B95AACF0030F65371E70 -lm
/tmp/ccyfxzbU.ltrans0.ltrans.o: In function `main':
/home/builder/.arduino15/packages/arduino/hardware/avr/1.8.4/cores/arduino/main.cpp:43: undefined reference to `setup'
/home/builder/.arduino15/packages/arduino/hardware/avr/1.8.4/cores/arduino/main.cpp:46: undefined reference to `loop'
collect2: error: ld returned 1 exit status
Error during build: exit status 1
it's the same in desktop ide.
There are steps for how to fix it:
- first, plugin the board to the pc
- right click on my computer and select manager
- from device manager select ports then select the Arduino port and uninstall device
- plug out the Arduino and plug it in again, the pc will detect the board automatically
- try to upload any example
hope you find it useful