News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Getting Error: "In function `_start': Undefined reference to main"

Started by Roy Strachan, May 18, 2010, 11:58:14 PM

Previous topic - Next topic

Roy Strachan

When trying to compile a simple test program I get the error: "In function `_start': Undefined reference to main". Of course there is a 'main' in my program (but no '_start', which must be a control in c::b).  Does anyone know how to get past this?

stahta01

Quote from: Roy Strachan on May 18, 2010, 11:58:14 PM
When trying to compile a simple test program I get the error: "In function `_start': Undefined reference to main". Of course there is a 'main' in my program (but no '_start', which must be a control in c::b).  Does anyone know how to get past this?

This is a Compiler (Linker) Error; without knowing your compiler the only thing to think is wrong is user error (or bad compiler).
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Your likely typo-ed the word main (case-sensitive) or the arguments it takes or the return type.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

rebelxt

My problem when I got this message turned out to be a file name problem. I had named my main module 'main.cc'. I removed it from the project, renamed it to 'main.cxx', and added it back into the project. The error disappeared.
:D