I upgraded to IDE 2.3.10 on a PC using Windows 10. I connected a Pro Mini with an FTDI cable on Com 4. I attempted to compile the Blink.ino example. I received the following error message in the output window. I did not encounter this problem on another computer with Windows 11. I read all of the posts on this subject I could find but nothing that helped. Thank you for any assistance in advance.
FQBN: arduino:avr:pro
Using board 'pro' from platform in folder: C:\Users\ac9459427\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.8
Using core 'arduino' from platform in folder: C:\Users\ac9459427\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.8
Detecting libraries used...
Using cached library dependencies for file: C:\Users\ac9459427\AppData\Local\arduino\sketches\881FA02A08B07DB4C17A39B9AF8BCCF4\sketch\Blink.ino.cpp.merged
Generating function prototypes...
Using cached sketch with function prototypes.
Compiling sketch...
Using previously compiled file: C:\Users\ac9459427\AppData\Local\arduino\sketches\881FA02A08B07DB4C17A39B9AF8BCCF4\sketch\Blink.ino.cpp.o
Compiling libraries...
Compiling core...
Using precompiled core: C:\Users\ac9459427\AppData\Local\arduino\cores\arduino_avr_pro_cpu_16MHzatmega328_f3818e81a1eabfeffb3cb3f3c681800f\core.a
Linking everything together...
"C:\\Users\\ac9459427\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\ac9459427\\AppData\\Local\\arduino\\sketches\\881FA02A08B07DB4C17A39B9AF8BCCF4/Blink.ino.elf" "C:\\Users\\ac9459427\\AppData\\Local\\arduino\\sketches\\881FA02A08B07DB4C17A39B9AF8BCCF4\\sketch\\Blink.ino.cpp.o" "C:\\Users\\ac9459427\\AppData\\Local\\arduino\\sketches\\881FA02A08B07DB4C17A39B9AF8BCCF4/..\\..\\cores\\arduino_avr_pro_cpu_16MHzatmega328_f3818e81a1eabfeffb3cb3f3c681800f\\core.a" "-LC:\\Users\\ac9459427\\AppData\\Local\\arduino\\sketches\\881FA02A08B07DB4C17A39B9AF8BCCF4" -lm
c:/users/ac9459427/appdata/local/arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/../lib/gcc/avr/7.3.0/../../../../avr/lib/avr5/crtatmega328p.o:(.init9+0x0): undefined reference to `main'
collect2.exe: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
You might have written a main() function in your sketch, but an Arduino sketch already has one (in its Arduino.h library) and needs to have a void setup(void){} function and a void loop(void){} function.
// Minimal Arduino sketch
void setup() {
// run once.
}
void loop() {
// run repeatedly.
}
Like a week ago, I was writing some test code for a question on the forums here. I use Wokwi since I don't have an AVR board to run it. The code was pretty simple, like several println statements to show different combos of stuff. But it seemed like every other line I added, it would fail with that linker error. Adding an additional slightly different line, it worked OK. This repeated maybe three times. I got what I wanted to work, and didn't pursue it further.
You can see from the output that you're running board version 1.8.8. The first thing to try is downgrade to maybe 1.8.7 and see if it magically fixes it.
If you enable verbose output during compilation under file → preferences you should see a line indicates that main is compiled. Because the compilation results are cached you will need to compile using <ctrl><shift>R (or click the verify icon while keeping the <shift> button pressed).
That might solve the issue.
The output should contain a line referring to main like
If you do not see that line, the error usually indicates a corrupt installation. To try to solve that you can downgrade the AVR board package (as mentioned above), test and next upgrade again.
The file main.cpp should available in C:\Users\bugge\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.8\cores\arduino and the compiled main.cpp.o in C:\Users\bugge\AppData\Local\arduino\sketches\49E70627EAD7AB46D5967E469ACE2FFF\core where 49E70627EAD7AB46D5967E469ACE2FFF is the cache directory (not that this one might change).
When you installed IDE 2.3.10, did you do a clean install or did you just do an update?
Thank you all for your assistance. I followed the advice from sterretje and held down the shift key when verifying/uploading and it worked fine. Interestingly, subsequent attempts also were successful without using the shift key. ??
The cache contained old data and there was no main.cpp.o; don't ask me why.
The cache was cleared the first time you used the <shift> button during the verify; after that it was rebuild correctly and you did not need the <shift>.
I've merged your new topic with (this) existing one.