I have two C++ programs that both share a class. progOne.cpp and progTwo.cpp. They both share a class, fileInfo.cpp with the appropriate fileInfo.h file.
This is how
You need:
all: progOne progTwo
This tells make that all
depends on progOne
and progTwo
. If you use all: progOne.cpp ...
then if progOne.cpp
already exists, make will not need to do anything, and says "nothing to be done for all".
Of course, next you have to explain to make how progOne
and progTwo
depend on the source files, so that when you update the source-file, it rebuilds the executable file.
You may also want to add any header files for progOne.cpp
to the dependencies, e.g. progOne: progOne.cpp progOne.h
- so that if progOne.h
is updated, the program is rebuilt.