#Include "class" problems
Hello to you all!
I have I problem with a project of mine, it occures when I want to include a class that I have made...
Looks something like this
//Class to include
Class Adventure
{
public:
void happenOnRoll();
void monsterMeeting();
void findItem();
void findGold();
private:
}a;
// end of class definition
I donīt have to have this in a class, but I placed it there to save some room in the main file..
Ok! now when I include this file to my main.cpp file, everything is ok. But when I call for a function ex. a.happenOnRoll(), the compiler starts to complain...
It says something like this:
void __thiscall Adventure::happenOnRoll(void)
I really hope that someone can help me on this, Thanx
My methods is in a separete file, the above .cpp file
Hmm maybe I missled you by not printing both the .h and the .cpp file directly after one nother, but I include a file named Adventure.h, to a file named Adventure.cpp, where I have my methods.
And sorry about that but I forgot to write that I use as u did write.
#ifndef ADVENTURE_H
#define ADVENTURE_H
"class definition"
#endif
Hmm, this could take a wile, if I keep...
I am really sorry about that, I accidentally wrote a C instead of c in the message.
The strange thing is that I have another class that I include to the main file, and it works as it should, so I dont really understand why I cant get this to work...
This is my other header file that works after being included:
#ifndef CHARACTER_H
#define CHARACTER_H
const int CH_MAX = 30;
class Character
{
public:
Character()
{
x = 5;y = 5;
strcpy(name,"Unnamed");
strcpy(gender,"Unknown");
}
~Character(){}
// set Functions
void setXcoord(int xc){ x = xc; }
void setYcoord(int yc){ y = yc; }
// get Functions
int getXcoord(){ return x; }
int getYcoord(){ return y; }
// other
void walking();
char name[CH_MAX];
char gender[CH_MAX];
private:
int x,y;
}c;
#endif
Here it is (unresolved external)
unresolved external symbol "public: void __thiscall Adventure::happenOnRoll(void)