I’m currently in the middle of refactoring my project, I have a lot of c++ classes that reference each other and want to strictly use forward declarations in my header files.
In short - is this a valid structure:
MyClass.h:
class ReferenceClass;
class MyClass {
public:
void DoThingsWithRef();
SharedPtr<ReferenceClass> pRef;
}
MyClass.cpp:
void MyClass::DoThingsWithRef()
{
pRef->DoThings();
}
I Keep Getting Compile Errors:
2>c:\urho3d-1.7\build\include\urho3d\core\../Container/Ptr.h(223): error C2027: use of undefined type 'GridGeographicData'
2>c:\users\casht\repos\greatgame\GridWorld.h(15): note: see declaration of 'GridGeographicData'
2>c:\urho3d-1.7\build\include\urho3d\core\../Container/Ptr.h(220): note: while compiling class template member function 'void Urho3D::SharedPtr<GridGeographicData>::ReleaseRef(void)'
2>c:\urho3d-1.7\build\include\urho3d\core\../Container/Ptr.h(79): note: see reference to function template instantiation 'void Urho3D::SharedPtr<GridGeographicData>::ReleaseRef(void)' being compiled
2>c:\users\casht\repos\greatgame\Grid.h(93): note: see reference to class template instantiation 'Urho3D::SharedPtr<GridGeographicData>' being compiled
2>c:\urho3d-1.7\build\include\urho3d\core\../Container/Ptr.h(223): error C2227: left of '->ReleaseRef' must point to class/struct/union/generic type