我有一个不会编译的C ++项目,并且会产生以下2个错误:
错误LNK1120 1未解决的外部问题
错误LNK2019无法解析的外部符号“ public:虚拟__cdecl引用了StartWindow ::〜StartWindow(void)“(?? 1StartWindow @@ UEAA @ XZ)在函数public中:void __cdecl StartWindow ::`vbasedestructor'(void)“(?? _ DStartWindow @@ QEAAXXZ)
StartWindow是我定义的一个类,但是目前它从未被实例化或包含在项目中的任何地方。删除该类可以使项目进行编译,但是如果该类在项目中,则不会。
如果缺少某些内容,我将包括该类的代码:
。CPP文件
#include "StartWindow.h"
StartWindow::StartWindow()
{
setImmediateDrawMode(false);
}
void StartWindow::onDraw()
{
clearScreen(WHITE);
EasyGraphics::onDraw();
}
头文件:
#pragma once
#include "EasyGraphics.h"
class StartWindow : public EasyGraphics
{
public:
StartWindow();
~StartWindow();
private:
virtual void onDraw();
};
谢谢。
您缺少StartWindow
的析构函数的实现。在您的实现文件(.cpp文件)中,附加:
StartWindow::~StartWindow(){
//if your destructor is non-trivial, include definition here
}