I have three files: movie.h (header); movie.cpp (implementation file); lab9.cpp (driver file using movie class)
I was given this sample on how to generate a makefile to compile the above files:
http://sci.tamucc.edu/~ptedford/1436Spr12/1436CommonFiles/MakeFileExample.txt
However, I’m still having trouble grasping the concept here (I don’t even know where to fill in my filenames because the sample file names confuse me (such as: what is main.o supposed to represent here?)).
Can someone help me make sense of this (a solution with an explanation), such that it produces a single executable called lab9?
Edit: I have the following in my makefile:
linkAndRun: lab9.o movie.o
g++ movie.o lab9.o -o lab9
movie.o: movie.cpp movie.h
g++ -c movie.cpp -o movie.o
lab9.o: lab9.cpp
g++ -c lab9.cpp -o lab9.o
I’m getting several compile errors, but the compile itself seems successful. Is this correct? The two answers provided so far both had differences, so I combined what I felt was the correct things. So confirmation would help though.
Here is what you are looking for-