I have declared a class in a header file (.h), and I defined its constructor and functions (including default constructor) in a .cpp
Now I want to declare an object in another header file, and initialize it in another .cpp file. I need to do it like this because the initialization of the object depends on some variables in the cpp.
The declaration in the .h file is made like this:
Saboteur *activeFault; /*Saboteur is the class, activeFault the object*/
When I try to compile my program I get the following error:
error C2143: syntax error : missing ‘;’ before ‘*’.
Any clue why this happens??
Hint: #includes are all ok, and the most strange thing is that I get the error when the compiler tries to compile the .cpp file where the functions of the class Saboteur are defined, but it says that the error is in the line written above (which is the other cpp file).
Prototype the Saboteur class. Declare:
before that declaration of
activeFault.Then, in other place, you provide the full definition of
class Saboteur.