I have a c++ project which has a class called A
.
I also have a header file, called Definitions.h
.
I wrote the following code in the header file:
A* aClass;
And in the main of the application, I write:
aClass = new A();
This gives me the redefinition errors of class A
by the other classes which use it.
So, after searching the web, I found out that the extern
keyword should be added to the deceleration, so I modified the header file's class deceleration into this:
extern A* aClass;
Now I'm getting LNK2001
errors.
What am I missing?