In function `_start':
undefined reference to `main'

what does this mean? I don't have a function _start. and my main.cpp is empty, theres just a few giant source files (500+ lines together) that are never called...

Do you see any problems with this that might have something to do with this?
I definitely don't...

7 Years
Discussion Span
Last Post by jackmaverick1

The _start function is something that the compiler generates. It's actually the first function that starts the program (called the entry-point). Nominally, all this function does is call the main() function. If you do not have a main() function defined anywhere (empty source file or whatever), that is the error you will get. You need a main() function, otherwise you won't be able to compile into an executable program.


You need at least this to compile any C++ code into a program:

int main() { }; //the { } is very important.

You don't need any code in between the { } to compile, but the application just won't execute anything. If you have either no function called main, or you have the above without the { }, the compiler will not be able to compile it into an executable program.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.