Base class undefined

If you have any source file that includes GameObjects.h before ProjectilObject.h or does not include ProjectilObject.h directly, then the compiler will first find the declaration of ProjectilObject through the include in GameObjects.h before knowing what WorldObject is. That is because GameObjects.h first includes ProjectilObject.h and then declares WorldObject. In that case the include of GameObjects.h present in ProjectilObject.h won’t work because _GAMEONJECTCODE_H_ will be already defined.

To avoid this, either be sure to include ProjectilObject.h instead of GameObjects.h in your source file, or use forward declarations.

Leave a Comment