I'm working on a makefile for a simple program and it has two files associated with it: main.cpp and game.adt. From game.adt I'm supposed to split it into 2 parts for the header and source code (guess.h and guess.cpp) using csplit. I've tried compiling the makefile like this:
HEADERS=guess.h
#Targets:
default: guessGame
guessGame: guess.o main.o
g++ guess.o main.o -o guessGame
guess.o: guess.cpp $(HEADERS)
g++ -c guess.cpp -o guess.o
main.o: main.cpp $(HEADERS)
g++ -c main.cpp -o main.o
clean:
-rm -f guessGame *.o
However it says there's 'no rule for target guess.cpp needed for guess.o.' Same goes for the header file. I know it's because the files 'guess.cpp' and 'guess.h' don't exist but it's because I'm supposed to split the .adt file to make it into guess.cpp and guess.h. How do I create a rule then for targets guess.cpp and guess.h using the adt file?
cspiltthen you will need to provide more information about the format and content of thegame.adtfile. Or are you asking how to add an existingcsplitcommand as part of a Makefile?adtfile, we must see the relevant bits of that file.