I have a makefile that creates object files for two classes (and main) and one of those classes is just defined in a .h file. In my makefile I have a line that says
FileName.o: FileName.h
g++ -c FileName.h
but when I try to compile it says it can't find FileName.o
Do I have to create FileName.cpp in order to get this to compile?
You are using your class from FileName.h somewhere, aren't you? So at least one of your .cpp files should contain #include "FileName.h"
, and .h's code will be compiled with this .cpp and you needn't compile .h's code separately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With