![]() |
compilation error : undefined reference to 'main'
Hi !
I have been learning C back from basics. Recently i tried out a simple program myHello.c , which contained the following code :
gcc -Wall myHello.c helloFunc.c -o newHello I received the following error : /usr/lib/gcc/i486-linux-gnu-4.3.3/../../../../libcrt1.o: In function '_start' : /build/buildd/libc-2.9/csu/../sysdeps/i386/elf/start.S:115: undefined reference to 'main' collect2: ld returned 1 exit status i tried googling , but couldnt get a satisfying solution ! please help ! <Manoj> |
Re: compilation error : undefined reference to 'main'
hey try removing 'void' from main............
|
Re: compilation error : undefined reference to 'main'
Hi !
I tried a different solution : just use a Makefile. You need to build them using: gcc -c helloFunc.c -o helloFunc.o gcc -c myHello.c -o myHello.o gcc myHello.o helloFunc.o -o hello Let me also try the solution you suggested . Thanks :-) |
| All times are GMT +5.5. The time now is 22:16. |