mercredi 4 mars 2020

creating makefile for templated doubly-linked list class

So this is for an assignment for a data structures class; however, I'm not actually in the class its just extra credit. I have to make a templated doubly-linked list class, along with an associated iterator class, which I believe I'll be able to figure out; however, I can't seem to figure out the makefile to get it all to compile.

This is my makefile:

mydriver: mydriver.o tlist.o tnode.o
        g++ -o mydriver -std=c++11 mydriver.o tlist.o tnode.o
mydriver.o: mydriver.cpp
        g++ -c -std=c++11 mydriver.cpp
tlist.o: tlist.h tlist.hpp
        g++ -c -std=c++11 tlist.h
        g++ -c -std=c++11 tlist.hpp
tnode.o: tnode.h
        g++ -c -std=c++11 tnode.h
clean:
        -rm *.o
        -rm *.h.gch

This is the error I get when I run make:

g++ -c -std=c++11 tlist.h
g++ -c -std=c++11 tlist.hpp
g++ -c -std=c++11 tnode.h
g++ -o mydriver -std=c++11 mydriver.o tlist.o tnode.o 
g++: error: tlist.o: No such file or directory
g++: error: tnode.o: No such file or directory
make: *** [mydriver] Error 1

So to reiterate, I have a tlist.h, tlist.hpp, tnode.h and mydriver.cpp. Thank you guys so much!

Aucun commentaire:

Enregistrer un commentaire