Author Topic: Getting Error: "In function `_start': Undefined reference to main"  (Read 15802 times)

Roy Strachan

  • Guest
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?

Online stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Getting Error: "In function `_start': Undefined reference to main"
« Reply #1 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.
« Last Edit: May 19, 2010, 01:21:37 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline rebelxt

  • Single posting newcomer
  • *
  • Posts: 5
Re: Getting Error: "In function `_start': Undefined reference to main"
« Reply #2 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