Error compiling for board Arduino/Genuino Mega or Mega 2560 - 3D printer

Arduino: 1.8.13 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

I know this error code is common, and i have read lots of post on how to fix it, but nothing is working for me. Long story short, the Adriano was working and loading new firmware to the printer fine, but then the "ghost in the shell" decided to stop making it work.

To make a short story longer, Man, I am desperate !!! I'm just getting by (thanks, COVID!) and trying to stay afloat by selling some custom 3d prints, but I can't get anything to work!! Thank you in advance to anybody who can help !!

C:\Users\JAMES~1.SMO\AppData\Local\Temp\ccPU59qf.ltrans0.ltrans.o: In function `main':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:43: undefined reference to `setup'

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:46: undefined reference to `loop'

collect2.exe: error: ld returned 1 exit status

exit status 1

Error compiling for board Arduino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation."
option enabled in File -> Preferences.

You don’t have a loop function in the code you didn’t post or reference.


There is a bug in the Arduino IDE that will cause this when you do a File > Save As with the Marlin 3D printer firmware or other sketches that put source files under the src subfolder of the sketch (that folder is not saved along with the sketch files from the root folder.

The solution is to manually copy the src subfolder from the original sketch over to the folder of your customized sketch you used "Save As..." to create.

I could provide detailed instructions for fixing this if I had more information, but based on what you told me this is as much as I can do.