I have a game program and I am getting VERY frustrated. Everything was running fine, and I decided to clean up my program by making separate files for each set of functions. The code is very long with multiple files, but heres the basic idea:
Im on Windows XP using the Code::Blocks IDE
In my entity.h
Ive declared all of my functions and variables for that class. In my entity.cpp
Ive included it, as well as in all my other files. But Im still getting a huge list of errors that tell me I have an undefined reference to all of the methods in entity.h as well as all my other header files. For example, I have a function call print()
to make it easier to print out things, and thats the first method I call from the entity.h
file. I get this error:
Heres the code for print():
void print(string f) {
cout<<f<<endl;
}
How Im calling it:
void Player::win(){
entity e;
e.print("You have defeated the orc");
} The error:
In function 'ZN6Player3winEv': undefined reference to 'entity::print(std::string)'
And yes, I do have an object
of entity
.