I tried to compile the absolute minimum of a sketch and upload it to an Uno:
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
I get following error:
Arduino: 1.8.6 (Windows 7), Board: "Arduino/Genuino Uno"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\vid\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=0X2A03_0X0043 -ide-version=10806 -build-path C:\Users\vid\AppData\Local\Temp\arduino_build_178663 -warnings=none -build-cache C:\Users\vid\AppData\Local\Temp\arduino_cache_312230 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\vid\AppData\Local\Temp\untitled812700306.tmp\sketch_sep10a\sketch_sep10a.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\vid\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=0X2A03_0X0043 -ide-version=10806 -build-path C:\Users\vid\AppData\Local\Temp\arduino_build_178663 -warnings=none -build-cache C:\Users\vid\AppData\Local\Temp\arduino_cache_312230 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\vid\AppData\Local\Temp\untitled812700306.tmp\sketch_sep10a\sketch_sep10a.ino
Using board 'uno' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10806 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "C:\\Users\\vid\\AppData\\Local\\Temp\\arduino_build_178663\\sketch\\sketch_sep10a.ino.cpp" -o nul
Generating function prototypes...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10806 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "C:\\Users\\vid\\AppData\\Local\\Temp\\arduino_build_178663\\sketch\\sketch_sep10a.ino.cpp" -o "C:\\Users\\vid\\AppData\\Local\\Temp\\arduino_build_178663\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Program Files (x86)\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\vid\\AppData\\Local\\Temp\\arduino_build_178663\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10806 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "C:\\Users\\vid\\AppData\\Local\\Temp\\arduino_build_178663\\sketch\\sketch_sep10a.ino.cpp" -o "C:\\Users\\vid\\AppData\\Local\\Temp\\arduino_build_178663\\sketch\\sketch_sep10a.ino.cpp.o"
Compiling libraries...
Compiling core...
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\wiring_pulse.S.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\wiring_analog.c.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\WInterrupts.c.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\hooks.c.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\wiring_digital.c.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\wiring_pulse.c.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\wiring_shift.c.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\wiring.c.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\WMath.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\abi.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\WString.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\new.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\HardwareSerial.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\HardwareSerial2.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\CDC.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\HardwareSerial0.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\IPAddress.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\HardwareSerial3.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\HardwareSerial1.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\Tone.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\Stream.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\USBCore.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\main.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\PluggableUSB.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\Print.cpp.o
Using previously compiled file: C:\Users\vid\AppData\Local\Temp\arduino_build_178663\core\core.a
Archiving built core (caching) in: C:\Users\vid\AppData\Local\Temp\arduino_cache_312230\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a
Linking everything together...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\vid\\AppData\\Local\\Temp\\arduino_build_178663/sketch_sep10a.ino.elf" "C:\\Users\\vid\\AppData\\Local\\Temp\\arduino_build_178663\\sketch\\sketch_sep10a.ino.cpp.o" "C:\\Users\\vid\\AppData\\Local\\Temp\\arduino_build_178663/core\\core.a" "-LC:\\Users\\vid\\AppData\\Local\\Temp\\arduino_build_178663" -lm
`__vector_16' referenced in section `.vectors' of c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avr5/crtatmega328p.o: defined in discarded section `.text' of wiring.c.o (symbol from plugin)
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avr5/crtatmega328p.o:(.init9+0x0): undefined reference to `main'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.
I know that this might be a generic error and might be linked to my operating system. Any help or hint in the right direction would be highly appreciated.
You're compiling for an Uno, but your output shows HardwareSerial1,2,3 (for mega) as well as stuff that seems to be for 32U4 based board (Leonardo,...), network stuff etc.
`__vector_16' referenced in section `.vectors' of c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avr5/crtatmega328p.o: defined in discarded section `.text' of wiring.c.o (symbol from plugin)
Maybe you're experiencing a mismatched AVR core and toolchain, perhaps related to issue #7973?
Recommend downloading the "hourly build" to get a copy with problem fixed. Or wait for the 1.8.7 release, probably coming later today. When you run the fixed version, click Tools > Boards > Manage Boards and update the AVR boards. Maybe that will solve this problem?
thank you very much for the swift response! It is a real machine, I am using a USB 2.0 port. The board is connected to the PC through a hub (using several boards (all Unos) in parallel - has been working fine for weeks until the reported error occurred...). The boards show up correctly in the device manager. The boards are powered through dedicated power supplies, which is needed for the application. Yesterday I have tried different USB cables, reinstalling the IDE and all kinds of different settings in the IDE and deleting the settings file in the Arduino15 folder to start off fresh. Nothing worked so far.
I will go to my lab in a minute and try:
switching off the external power supply of my Arduinos
try with antivirus switched off
try the latest build/1.8.7
Disconnecting everything from the board is difficult. The Unos are built into a box with some more electronics, each Uno carries a stack of 3 adafruit motor driver shields. I would like to avoid opening and disconnecting everything (it used to be fully operational in this configuration!).
Many thanks for the suggestions up to this point. I will report on my progress after lunch
You don't need to bother with USB cables, disconnecting things from the board, and the power supply. This is a compiler error. It's completely unrelated to hardware. It will happen even if you don't have the board plugged into your computer.
I went through the list of proposed solutions, without success so far. So I am waiting for 1.8.7, or a fresh hourly build.
sterretje:
Close IDE, open it and compile.
You're compiling for an Uno, but your output shows HardwareSerial1,2,3 (for mega) as well as stuff that seems to be for 32U4 based board (Leonardo,...), network stuff etc.
I also find that quite strange. I think things got messed up after a Windows update. What can I do to really get back to ground zero in terms of the Arduino IDE and try a fresh start?
bear05:
What can I do to really get back to ground zero in terms of the Arduino IDE and try a fresh start?
There are three separate folders used by the Arduino IDE:
Arduino IDE installation folder: C:\Program Files (x86)\Arduino
Data folder: C:\Users\vid\AppData\Local\Arduino15
Sketchbook folder: C:\Users\vid\Documents\Arduino
Compilation output is also stored in a couple different folders. These have randomized names and should be deleted every time you exit the Arduino IDE (hence sterretje's advice). In the output you provided above they are:
I deleted the IDE and all associated folders from ..\AppData\Local and ..\AppData\Local\Temp.
Then I downloaded the latest currently available hourly build (IDE says: Sept 10, 06:33, homepage says: Sept 10, 18:13, but anyhow...).
Upon running above minimal sketch I get the same type of error (this time short output):
Arduino: 1.8.7 Hourly Build 2018/09/10 06:33 (Windows 7), Board: "Arduino/Genuino Uno"
`__vector_16' referenced in section `.vectors' of c:/users/vid/downloads/arduino-nightly/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avr5/crtatmega328p.o: defined in discarded section `.text' of wiring.c.o (symbol from plugin)
c:/users/vid/downloads/arduino-nightly/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avr5/crtatmega328p.o:(.init9+0x0): undefined reference to `main'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Any help is greatly appreciated. The rest of my setup seems to work and I have to use this opportunity
I again tried deleting and reinstalling everything - same result.
Then I tried the Arduino web editor, which compiles all my sketches nicely, but seems to have a problem with several Unos being connected at a time - it seems to always default back to one specific COM port.
I really need to get the IDE back working. Or any other solution to flash sketches to my Unos. I have to use my PC, as there is other proprietary software talking to the Unos via serial which can't be installed elsewhere that easily. Please help me, argh.
Maybe an overly aggressive anti-virus program with "real time scanning" (or maybe even Windows Defender) is interfering with the compiler's access to files?
did anybody found a solution for this issue ?
I'm on Win 7 Pro 64 bit.
I'm spending now 3 days on this issue .... unable to compile anything; even the minimal sketch fails as bear05 mentioned.
Completely cleaned IDE installation (incl. registry cleanup, deleting ..\Arduino15 directory and all AppdData* directories related to Arduino) and re-installed latest IDE version.
The error persists (this is for a minimal sketch with empty Setup() and empty loop() procedures):
`__vector_16' referenced in section `.vectors' of c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avr5/crtatmega328p.o: defined in discarded section `.text' of wiring.c.o (symbol from plugin)
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avr5/crtatmega328p.o:(.init9+0x0): undefined reference to `main'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Nano.
Selecting other boards (e.g. Mega) just change the board mentioned in the error message.
I've seen a lot of entries in different forums to this or similar errors, but have not seen any solution (IDE restart or reboot don't fix it for me).
@ballscrewbob:
my Nano is a china clone with old bootloader.
I tried both options (old / new bootloader) with no changes.
But same is true for lets say Mega.
In the PREFERENCES for the IDE is a setting for "Aggressively cache compiled core" you could try with that OFF
Below that is a "Check for updates on startup" whilst not related it has fixed some issues for others so also maybe worth a shot.
Unless you actually have a MEGA there is no point selecting it.
Symantec Endpoint has come up as a culprit for IDE issues a few times.
Those cleanup instructions of mine are still valid btw.
IIRC endpoint does not fully disable and there may still be services for EP running.
You should add the Arduino locations to EP's exclusions/whitelist.
I already disabled "Aggressively cache compiled core" with no change.
Meanwhile I moved from Win Installer version to zip and tested with 1.8.2 (I used before with no problems) and 1.8.8.
I played around with different version of board managers for Nano/Uno (back 1.6.11) but error remains the same or resulted in a 0 bytes compile.
Also tried different combinations of compiler options in platform.txt by removing -flto parameter at different places (hint from another post), but same results as with different board managers.
I disabled Symantec EP (I know there might processes remaining, but co-existed with no problems for years so far) : no change.
I've admin rights on the machine so should not make a difference.
From your search result list I found a hint regarding a damaged COM driver might have been the reason but didn't fit for (checked and reinstalled drivers).
Meanwhile I'm running our of ideas (beside using another laptop or online editor (not yet tried))