# Compilation Error

**URL:** <https://forum.arduino.cc/t/compilation-error/1460843>\
**Category:** IDE 2.x\
**Created:** [September 24, 2026, 9:37pm UTC](https://forum.arduino.cc/t/compilation-error/1460843 "2026-09-24T21:37:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ARDTECH](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ardtech/32/1282875_2.png) [@ARDTECH](https://forum.arduino.cc/u/ARDTECH)\
**Post date:** [September 24, 2026, 9:37pm UTC](https://forum.arduino.cc/t/compilation-error/1460843/1 "2026-09-24T21:37:53Z")

</div>

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.

```plaintext
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

```

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [September 24, 2026, 10:32pm UTC](https://forum.arduino.cc/t/compilation-error/1460843/2 "2026-09-24T22:32:10Z")

</div>

> [@ARDTECH](#):
>
> `undefined reference to 'main'`

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.

```arduino
// Minimal Arduino sketch

void setup() {
  // run once.
}

void loop() {
  // run repeatedly.
}

```

Post your code, here.

---

<div class="post-metadata">

**Author:** ![kenb4](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kenb4](https://forum.arduino.cc/u/kenb4)\
**Post date:** [September 24, 2026, 10:44pm UTC](https://forum.arduino.cc/t/compilation-error/1460843/3 "2026-09-24T22:44:35Z")

</div>

> [@ARDTECH](#):
>
> undefined reference to `main'

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 not, post the code.

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [September 25, 2026, 5:30am UTC](https://forum.arduino.cc/t/compilation-error/1460843/4 "2026-09-25T05:30:47Z")

</div>

> [@ARDTECH](#):
>
> `undefined reference to `main'`

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

```plaintext
"C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR "-IC:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.8\\cores\\arduino" "-IC:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.8\\variants\\eightanaloginputs" "C:\\Users\\bugge\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.8\\cores\\arduino\\main.cpp" -o "C:\\Users\\bugge\\AppData\\Local\\arduino\\sketches\\49E70627EAD7AB46D5967E469ACE2FFF\\core\\main.cpp.o"

```

Note:  
`bugge` is my username.

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?

---

<div class="post-metadata">

**Author:** ![ARDTECH](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ardtech/32/1282875_2.png) [@ARDTECH](https://forum.arduino.cc/u/ARDTECH)\
**Post date:** [September 26, 2026, 12:32pm UTC](https://forum.arduino.cc/t/compilation-error/1460843/5 "2026-09-26T12:32:11Z")

</div>

Continuing the discussion from [Compilation Error](https://forum.arduino.cc/t/compilation-error/1460843):

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

---

<div class="post-metadata">

**Author:** ![kmin](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kmin/32/1147370_2.png) [@kmin](https://forum.arduino.cc/u/kmin)\
**Post date:** [September 26, 2026, 12:35pm UTC](https://forum.arduino.cc/t/compilation-error/1460843/6 "2026-09-26T12:35:07Z")

</div>

So mark that advice as solution on your original topic.

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [September 26, 2026, 12:56pm UTC](https://forum.arduino.cc/t/compilation-error/1460843/7 "2026-09-26T12:56:46Z")

</div>

> [@ARDTECH](#):
>
> 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.
