我是C++的新手,在運行我的應用程序時遇到問題。我搜索了這個問題,但由於大多數結果都是鏈接庫,我開始了一個新線程。鏈接器錯誤:錯誤LNK2019:無法解析的外部符號
我有一個類CResizableDialog,我從我的VtkDialogTest2對話框類繼承。
VtkDialogTest2.h;
#pragma once
#include "CResizableDialog.h"
#ifdef _WIN32_WCE
#error "CDHtmlDialog is not supported for Windows CE."
#endif
// VtkDialogTest2 dialog
class VtkDialogTest2 : public CResizableDialog
{
DECLARE_DYNCREATE(VtkDialogTest2)
public:
VtkDialogTest2(CWnd* pParent = NULL); // standard constructor
virtual ~VtkDialogTest2();
// Overrides
HRESULT OnButtonOK(IHTMLElement *pElement);
HRESULT OnButtonCancel(IHTMLElement *pElement);
// Dialog Data
enum { IDD = IDD_DIALOG4 };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedOk();
};
VtkDialogTest2.cpp
#include "stdafx.h"
#include "Geometry.h"
#include "VtkDialogTest2.h"
IMPLEMENT_DYNCREATE(VtkDialogTest2, CResizableDialog)
VtkDialogTest2::VtkDialogTest2(CWnd* pParent /*=NULL*/)
: CResizableDialog(VtkDialogTest2::IDD, pParent),
{
}
VtkDialogTest2::~VtkDialogTest2()
{
}
void VtkDialogTest2::DoDataExchange(CDataExchange* pDX)
{
CResizableDialog::DoDataExchange(pDX);
}
BOOL VtkDialogTest2::OnInitDialog()
{
CResizableDialog::OnInitDialog();
//some code
return TRUE; // return TRUE unless you set the focus to a control
}
BEGIN_MESSAGE_MAP(VtkDialogTest2, CResizableDialog)
ON_BN_CLICKED(IDOK, &VtkDialogTest2::OnBnClickedOk)
END_MESSAGE_MAP()
//some code
我想不出什麼我做錯了。我從網上下載了一個使用CResizableDialog.h類的例子,並將CResizableDialog.h和CResizableDialog.cpp複製到我的項目中。
我得到的錯誤是;
1>VtkDialogTest2.obj : error LNK2019: unresolved external symbol "public: __thiscall CResizableDialog::CResizableDialog(unsigned int,class CWnd *)" ([email protected]@[email protected]@@@Z) referenced in function "public: __thiscall VtkDialogTest2::VtkDialogTest2(class CWnd *)" ([email protected]@[email protected]@@@Z)
1>VtkDialogTest2.obj : error LNK2019: unresolved external symbol "protected: virtual int __thiscall CResizableDialog::OnInitDialog(void)" ([email protected]@@MAEHXZ) referenced in function "protected: virtual int __thiscall VtkDialogTest2::OnInitDialog(void)" ([email protected]@@MAEHXZ)
1>VtkDialogTest2.obj : error LNK2001: unresolved external symbol "protected: static struct AFX_MSGMAP const * __stdcall CResizableDialog::GetThisMessageMap(void)" ([email protected]@@[email protected]@XZ)
1>C:\Users\Geometry.exe : fatal error LNK1120: 3 unresolved externals
任何輸入將不勝感激。
你是否在某些cpp文件中實現了這些方法並編譯/鏈接了該文件? –
'CResizableDialog'的實現似乎缺失。 –