Help with Makefile! Desperate!!!

First I will state, this is homework. I am stuck on this makefile thing and need assistance. I can't figure out why it is getting stuck where it is. I am using a header.h file, a header.cpp file, and a project.cpp file. I will post my makefile first, then the header.h, then the header.cpp. Both the header.cpp and project.cpp compile fine individually, but I get this error at the end of the makefile:

g++ -g -c proj4.cpp
g++ -g -c stackhh.cpp
g++ -o project4 proj4.o
Undefined first referenced
symbol in file
Stack::pop(char&) proj4.o
Stack::push(char) proj4.o
Stack::Stack(int) proj4.o
Stack::~Stack() proj4.o
ld: fatal: symbol referencing errors. No output written to project4
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `project4'

This is due at midnight tonight and if I can't get it to compile, I am SOL. Thanks for the assistance in my learning!!!

EDIT: The solution:
1
2
3
4
5
the first and second line should read:

project4: proj4.o stackhh.o
     g++ proj4.o stackhh.o -o project4



I know this is a lot of code thrown up, but I don't know where to start with this issue! I will keep trying to troubleshoot, but I am ew to makefile and when I had this all in one program it compiled just fine! Not sure where they aren't syncing... I appreciate any and all help, thank you soooo much in advance!

-Arcie
Last edited on
I appreciate those links. I have read over the first one and my situation doesn't "seem" to apply to any of them. I have everything defined properly, in the right order, and in the right files. I have the .h file in the definitions on each cpp file. I just cannot figure this out.

-Arcie
SOLVED! Thanks ne555! A bit of time on those links and I finally figured it out! You rock!!!

-Arcie

PS Editing my first post with the fix for anyone in the future looking for a similar issue.
Topic archived. No new replies allowed.