-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Description
I wrote a small program with no errors in it, but found when compiling I got the error "Undefined reference to main". Obviously that is stupid since Arduino defines its own main... But wait... I bet I know how they've screwed up (I thought).
Turns out I was right! If you call your program main
Arduino's none-too-bright build system will get confused and fail to find its own main. There's obviously some serious bodgery going on in there since my program resides in main.ino
and doesn't declare any main()
functions. And presumably the Arduino source code is specified with an absolute path (right? guys? right?) and does have a main()
. You're surely not doing #include "main.ino"
somewhere because that would be crazy.
Anyway, when I renamed my program it worked fine. At the very least you should add a warning to the File->Save As dialogue in case the user tries to save the program as "main" (a quite reasonable name I think!).