Click to See Complete Forum and Search --> : A simple question about writing a Makefile


warrener
April 29th, 2008, 04:25 PM
I have main.cc and test.h files,
main.cc includes test.h

Here is the Makefile, but it doesn't work. any clue?


main : main.o
g++ -g main.o -o main
main.o : main.cc test.h
g++ -o main.o -c -g test.h main.cc

MrViggy
April 29th, 2008, 05:42 PM
Define "doesn't work".

Viggy

olivthill
April 30th, 2008, 05:59 AM
A common mistake is the use of spaces instead of a tab character at the beginning of a command line. I don't know if this is the case, here.

See http://www.gnu.org/software/make/manual/make.html