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

Recommended Answers

All 4 Replies

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.

I have a completly empty one.

Should I just put a "cout" in there?
Would that fix it?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.