4
votes

Possible dup of this or this, but even after trying to dig through the answers for a while, I couldn't resolve this.

While trying to compile following makefile,

all:  test

    test:  constants.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.cpp line_t.cpp drawing_t.cpp clipper_t.cpp main.cpp -lglut

I get an error:

g++ -o test Point.cpp line_t.cpp drawing_t.cpp clipper_t.cpp main.cpp -lglut /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crt1.o: In function _start': (.text+0x18): undefined reference tomain' collect2: ld returned 1 exit status make: *** [test] Error 1

I am new at Makefile. I guess, I am missing something too obvious.

1

1 Answers

5
votes

Apparently none your files define a function with the signature

int main();

or

int main(int argc, char *argv[]);