如何修复C++;链接器错误,没有解释 我有一个C++项目,它不会编译,产生以下2个错误:
错误LNK1120 1未解析的外部 错误LNK2019未解析的外部符号“public:virtual\uu cdecl” StartWindow::~StartWindow(无效)”(??1StartWindow@@UEAA@XZ)参考 在函数“public:void\uu cdecl StartWindow::`vbase”中 析构函数“(void)”(??\u DStartWindow@@QEAAXZ) StartWindow是我定义的一个类,但目前它从未被实例化或包含在项目的任何地方。删除类允许项目编译,但如果该类在项目中,则不会编译 我将包括该类的代码,以防遗漏某些内容: .CPP文件如何修复C++;链接器错误,没有解释 我有一个C++项目,它不会编译,产生以下2个错误:,c++,class,oop,linker,linker-errors,C++,Class,Oop,Linker,Linker Errors,错误LNK1120 1未解析的外部 错误LNK2019未解析的外部符号“public:virtual\uu cdecl” StartWindow::~StartWindow(无效)”(??1StartWindow@@UEAA@XZ)参考 在函数“public:void\uu cdecl StartWindow::`vbase”中 析构函数“(void)”(??\u DStartWindow@@QEAAXZ) StartWindow是我定义的一个类,但目前它从未被实例化或包含在项目的任何地方。删除
#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
的析构函数的实现。在实现文件(.cpp文件)中,附加:
或
StartWindow::~StartWindow()=默认值如果析构函数是平凡的或StartWindow::~StartWindow()=default,则code>也是true,是如果析构函数是平凡的,则代码>也是true,是
StartWindow::~StartWindow(){
//if your destructor is non-trivial, include definition here
}