Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: Roy Strachan on May 18, 2010, 11:58:14 pm

Title: Getting Error: "In function `_start': Undefined reference to main"
Post by: 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?
Title: Re: Getting Error: "In function `_start': Undefined reference to main"
Post by: stahta01 on May 19, 2010, 01:18:52 am
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.
Title: Re: Getting Error: "In function `_start': Undefined reference to main"
Post by: rebelxt on August 11, 2011, 04:17:21 am
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