I have been trying for some time (in vain) to track down the cause of the following errors all thrown at the declaration of 'checkCollision()' in "PolygonGameObject.h" when I try to compile as a static library:
Error C3646 'checkCollision': unknown override specifier
Error C2059 syntax error: ')'
Error C2238 unexpected token(s) preceding ';'
In an attempt to track down the error, I have renamed the function, removed all function parameters, removed all content from the offending function (except a return statement returning an object created by the default constructor of the desired return type). For brevity, I have removed all content from the original program while still causing the same errors in an attempt to find the cause of the errors. I am using Visual Studio 2015 Community running on Windows 7. I am compiling the source files as a static library. Below are the stripped down source files with which I have produced the error:
CollisionData.h
#ifndef COLLISIONDATA_H
#define COLLISIONDATA_H
#include "Vec2D.h"
#include "PolygonGameObject.h"
#include <list>
struct CollisionData
{
double penetrationDepth;
Vec2D collisionNormal;
std::list<std::size_t> involvedIndicesA;
std::list<std::size_t> involvedIndicesB;
CollisionData();
CollisionData(double penetrationDepth, Vec2D collisionNormal, std::list<std::size_t> involvedIndicesA, std::list<std::size_t> involvedIndicesB);
~CollisionData();
static CollisionData noCollision();
};
#endif
CollisionData.cpp
#include "CollisionData.h"
using namespace std;
CollisionData::CollisionData()
{
}
CollisionData::CollisionData(double penetrationDepth, Vec2D collisionNormal,
list<size_t> involvedIndicesA, list<size_t> involvedIndicesB):
penetrationDepth(penetrationDepth), collisionNormal(collisionNormal),
involvedIndicesA(involvedIndicesA), involvedIndicesB(involvedIndicesB)
{
}
CollisionData::~CollisionData()
{
}
CollisionData CollisionData::noCollision()
{
return CollisionData(-1, Vec2D(0,0), list<size_t>(), list<size_t>());
}
PolygonGameObject.h
#ifndef POLYGONGAMEOBJECT_H
#define POLYGONGAMEOBJECT_H
#include "CollisionData.h"
class PolygonGameObject
{
protected:
double restitution;
double density;
double invMass;
public:
PolygonGameObject();
virtual ~PolygonGameObject();
static CollisionData checkCollision();
};
#endif
PolygonGameObject.cpp
#include "PolygonGameObject.h"
#include "CollisionData.h"
#include <limits>
#include <cmath>
#include <algorithm>
PolygonGameObject::PolygonGameObject()
{
}
PolygonGameObject::~PolygonGameObject()
{
}
CollisionData PolygonGameObject::checkCollision()
{
return CollisionData();
}
Thanks for your time!