When I try to compile my code by typing 'make' I get the error:
1 2 3 4 5
Marathon.cc:(.text+0x3e1): undefined reference to `View::validPos(Position&)'
Marathon.cc:(.text+0x46b): undefined reference to `View::update(Position&, Position&, char)'
collect2: error: ld returned 1 exit status
Makefile:2: recipe for target 'p1' failed
make: *** [p1] Error 1
I've double checked my capitals, spelling, and I included the View.h header file in Marathon.h. I don't believe there is anything wrong with my makefile. I was wondering if anyone could point out why I keep getting this error?
You aren't putting ClassName:: before the member function in the View.cc implementation file.
So it's defining update and validPos as standalone functions instead of as class members.
And the compiler doesn't catch this because you aren't using any member variables or member functions within either of these functions (so they could just be non-class functions, but that's up to you).