Using unique_ptr with forwarded class btCollisionObject error
Created by: Gerard097
Compiling on VS 2017 v 15.9.1 gives the next error:
error C2027: use of undefined type 'btCollisionObject'
As pointed out in this SO post https://stackoverflow.com/a/6089065/7908019 it is necessary for a unique_ptr to know the complete type of T when its destroyed. So CollisionObject should add an empty destructor definition on its cpp file (where btCollisionObject is a complete type) to solve this.
CollisionObject.hpp
class btCollisionObject;
class ACID_EXPORT CollisionObject :
public IComponent
{
protected:
std::unique_ptr<btCollisionObject> m_body; //Incomplete type
...
public:
~CollisionObject(); // Added destructor
...
};
CollisionObject.cpp
...
CollisionObject::~CollisionObject()
{
}
...
After adding the previous code it compiles without errors.