I made a simple makefile and can't figure out why it is getting an error.
It is actually getting two separate errors but I believe the second is a result of the first.
Here is my makefile
myProgram: main.o employee.o address.o
g++ -o main.o employee.o address.o
main.o: main.cpp employee.h address.h
g++ -c main.cpp address.h employee.h
employee.o: employee.cpp address.h
g++ -c employee.cpp address.h
address.o: address.cpp
g++ -c address.cpp
All the files are good and in the same directory as the makefile.
But when I run make I get these two errors
"g++ -c employee.cpp address.h
g++: compilation of header file requested
make: *** [employee.o] Error 1"
and
" g++ -c address.cpp
g++ -o main.o employee.o address.o
/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/../../../crt1.o(.text+0x18): In function `_start':
: undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [myProgram] Error 1"
I was told you can compile headers but this is what it seems to be getting hung up on.
Any suggestions?