Commenters are saying the right thing, but maybe not that clear.
In your AFactory.hpp file you have class A;
. This sort of statement is called "forward declaration". It states that A is a class and that details on this class will be given later. In your file main.cpp, for this or that reason, most likely because of the include preventers, the body of your your #include "A.hpp"
is not included.
This means that A
is still not defined. Compiler knows only that A
is a class and nothing else. Because of that compiler cannot handle aVec[i]->Initialize();
. The error message is saying this. Modify your include preventors to something else, like _A_FILE_HPP_
.