EDIT: I believe my issue is because I'm calling my FacePoint class from an .exe project, and FacePoint is actually located in a .dll project, both within the same solution. Any idea to combat this?
I have a class called FacePoint which gets and sets X and Y values of a face feature.
This is FacePoint.h:
#pragma once
class FacePoint
{
public:
FacePoint(void);
FacePoint(int X, int Y);
void FacePoint::SetX(int X);
void FacePoint::SetY(int Y);
void FacePoint::SetXY(int X, int Y);
int FacePoint::GetX();
int FacePoint::GetY();
~FacePoint(void);
private:
int coordX;
int coordY;
};
...and FacePoint.cpp:
#include "StdAfx.h"
#include "FacePoint.h"
FacePoint::FacePoint(void)
{
coordX = 0;
coordY = 0;
}
FacePoint::FacePoint(int X, int Y)
{
coordX = X;
coordY = Y;
}
void FacePoint::SetX(int X){ coordX = X; }
void FacePoint::SetY(int Y){ coordY = Y; }
void FacePoint::SetXY(int X, int Y)
{
coordX = X;
coordY = Y;
}
int FacePoint::GetX(){ return coordX; }
int FacePoint::GetY(){ return coordY; }
FacePoint::~FacePoint(){}
This seems OK to me, however when I try to implement a vector of FacePoint objects, as follows:
std::vector<FacePoint> point;
result = GetFeaturePoints(pHandle, &point);
int x = 0;
int y = 0;
for(int p = 0; p < point.size(); p++)
{
x = point[p].GetX();
y = point[p].GetY();
}
I get the following compile-time errors:
Error 37 error LNK1120: 3 unresolved externals
Error 36 error LNK2001: unresolved external symbol "public: __thiscall FacePoint::~FacePoint(void)" (??1FacePoint@@QAE@XZ)
Error 35 error LNK2001: unresolved external symbol "public: int __thiscall FacePoint::GetX(void)" (?GetX@FacePoint@@QAEHXZ)
Error 34 error LNK2001: unresolved external symbol "public: int __thiscall FacePoint::GetY(void)" (?GetY@FacePoint@@QAEHXZ)
I'm not sure why this is happening, but from the error messages, I suspect it's something to do with my destructor?...
I searched around and most of these issues were around missing a constructor/destructor definition. To my knowledge, my constructor seems fine, and the error message seems to hint at the destructor. The only thing I can think of is I'm missing a desctructor which destroys int X, int Y, but I didn't think primitives needed that?...
Any help is appreciated. Thank you!!
EDIT: So I forgot to #include "FacePoint.h" in my main (where I am creating the vector of FacePoint). I added that in, but am receiving this compile-time error message:
Error 4 error LNK2019: unresolved external symbol "public: __thiscall FacePoint::~FacePoint(void)" (??1FacePoint@@QAE@XZ) referenced in function "public: void * __thiscall FacePoint::`scalar deleting destructor'(unsigned int)" (??_GFacePoint@@QAEPAXI@Z)
Any idea, guys? Thanks!