Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » undefined reference to `main'(It comes and it goes)
undefined reference to `main' [message #506721] Sat, 09 January 2010 03:20 Go to next message
eewoz  is currently offline eewoz Friend
Messages: 12
Registered: December 2009
Junior Member
I started a new workspace and created a simple Hello World C program. When I build the project I get
**** Build of configuration Debug for project Try1 ****

make all 
Building file: ../Main.c
Invoking: GCC C Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"Main.d" -MT"Main.d" -o"Main.o" "../Main.c"
Finished building: ../Main.c
 
Building target: Try1
Invoking: GCC C Linker
gcc  -o"Try1"  ./Main.o   
/usr/lib/gcc/i486-linux-gnu/4.4.1/../../../../lib/crt1.o: In function `_start':
/build/buildd/eglibc-2.10.1/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [Try1] Error 1

in the console window.

I then build the canned Hello World C++ program in the same workspace. It builds and runs fine. I then try to rebuild my Hello World C program and it builds and runs fine.

This stuff is driving me nuts! Can anyone help?

Thanks.
Re: undefined reference to `main' [message #508186 is a reply to message #506721] Sun, 17 January 2010 11:50 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 3
Registered: January 2010
Junior Member
Please show your code.

Do 'gcc main.c -o Try1' and tell us if it works.
Re: undefined reference to `main' [message #508238 is a reply to message #508186] Mon, 18 January 2010 01:50 Go to previous message
eewoz  is currently offline eewoz Friend
Messages: 12
Registered: December 2009
Junior Member
No Real Name wrote on Sun, 17 January 2010 06:50
Please show your code.

Do 'gcc main.c -o Try1' and tell us if it works.


I've tried so many things since my original post that I can no longer get back to the state that I was in then. I've since reinstalled Eclipse using files directly from the Eclipse website rather than installing the package that came with my Linux program and seem to now be up and running OK.

Thank you for your interest though.
Previous Topic:Custom Toolchain Options
Next Topic:Programmatically compare two c++ files?
Goto Forum:
  


Current Time: Fri Nov 21 19:20:10 GMT 2014

Powered by FUDForum. Page generated in 0.02740 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software