Home > other >  C - compile-time undefined reference to 'main'
C - compile-time undefined reference to 'main'

Time:05-10

May repeat this or this, but even in trying to dig the answer after a period of time, I can't solve the problem.
When trying to compile the following makefile,

All: test

Test: the h Point. H Point. CPP line_t. H line_t. CPP drawing_t. H drawing_t. CPP clipper_t. H clipper_t. CPP main. CPP
G + + -o test Point. The CPP line_t. CPP drawing_t. CPP clipper_t. CPP main. CPP - lglut

I got an error:


G + + -o test Point. The CPP line_t. CPP drawing_t. CPP clipper_t. CPP main. CPP
- lglut/usr/lib/GCC/i686 - - the gnu/Linux 4.6/../../../i386 - - the gnu/Linux crt1. O: In function _start ': (. Text + 0 x18) : undefined reference tomain
'Collect2: ld returned 1 exit status make: * * * [test] Error 1

I'm new in the Makefile. I think I missed something obvious.

CodePudding user response:

Obviously, your files are not defined with a signature function

Int main ();

Or

Int main (int arg c, char * argv []);

CodePudding user response:

Praise a
It was less a space
  • Related