I am having a problem with my program. I am getting an error (shown below) when compiling my game.
I have the struct defined in a seperate file called variables.cpp, along with a global object array.
So it looks like this:
Code:
struct CharObj
{
//...
}character_obj[128];
While in the header file I made an external reference to it, looks like the following:
Code:
extern struct CharObj character_obj[128];
Yet, when I get the following error when compiling:
Code:
g++ -c -g Char_Movement.cpp
Char_Movement.cpp: In function `void PlayerMove(bool, bool, bool, bool, int)':
Char_Movement.cpp:10: error: invalid use of undefined type `struct CharObj'
space_carnage.h:67: error: forward declaration of `struct CharObj'
Char_Movement.cpp:10: error: invalid use of undefined type `struct CharObj'
space_carnage.h:67: error: forward declaration of `struct CharObj'
Char_Movement.cpp:22: error: invalid use of undefined type `struct CharObj'
space_carnage.h:67: error: forward declaration of `struct CharObj'
Char_Movement.cpp:22: error: invalid use of undefined type `struct CharObj'
space_carnage.h:67: error: forward declaration of `struct CharObj'
Char_Movement.cpp:34: error: invalid use of undefined type `struct CharObj'
space_carnage.h:67: error: forward declaration of `struct CharObj'
Char_Movement.cpp:34: error: invalid use of undefined type `struct CharObj'
space_carnage.h:67: error: forward declaration of `struct CharObj'
Char_Movement.cpp:46: error: invalid use of undefined type `struct CharObj'
space_carnage.h:67: error: forward declaration of `struct CharObj'
Char_Movement.cpp:46: error: invalid use of undefined type `struct CharObj'
space_carnage.h:67: error: forward declaration of `struct CharObj'
make: *** [Char_Movement.o] Error 1
Any suggestions? If need more information, please ask and I should respond right away.