Page 1 of 1

LNK2019 wxString::SubstrBufFromType

Posted: Fri Nov 29, 2019 2:01 am
by firescript
各位好:
在编译简单例子时出现如下错误:

Code: Select all

error LNK2019: unresolved external symbol "private: static struct wxString::SubstrBufFromType<class wxScopedCharTypeBuffer<unsigned short> > __cdecl wxString::ConvertStr(char const *,unsigned __int64,class wxMBConv const &)" ([email protected]@@[email protected][email protected]@@@[email protected][email protected]@@Z) referenced in function "private: static class wxScopedCharTypeBuffer<unsigned short> __cdecl wxString::ImplStr(char const *,class wxMBConv const &)" ([email protected]@@[email protected]@@[email protected]@@Z)
fatal error LNK1120: 1 unresolved externals
编译用的是Unicode版本
使用的lib如下:
wxbase31u.lib wxbase31u_net.lib wxbase31u_xml.lib wxexpat.lib wxjpeg.lib wxmsw31u_aui.lib wxmsw31u_core.lib wxmsw31u_gl.lib wxmsw31u_html.lib wxmsw31u_qa.lib wxmsw31u_ribbon.lib wxmsw31u_richtext.lib wxmsw31u_stc.lib wxmsw31u_webview.lib wxmsw31u_xrc.lib wxpng.lib wxregexu.lib winmm.lib wxscintilla.lib wxtiff.lib wxzlib.lib wxmsw31u_adv.lib wxmsw31u_media.lib wxmsw31u_propgrid.lib comctl32.lib rpcrt4.lib wsock32.lib odbc32.lib Ws2_32.lib urlmon.lib wininet.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

简单例子代码:

Code: Select all

simple_window.h
#ifndef SIMPLE_WINDOW_H
#define SIMPLE_WINDOW_H

#define wxDEBUG_LEVEL 0

#include <wx/wx.h>

class myFrame : public wxFrame
{
public:
	myFrame(const wxString title);
private:
	void OnQuitButton(wxCommandEvent &event);
	wxDECLARE_EVENT_TABLE();
};

#endif

Code: Select all

simple_window.cpp
#include"simple_window.h"

#define ID_BUTTON_QUIT 40000

wxBEGIN_EVENT_TABLE(myFrame, wxFrame)
	EVT_BUTTON(ID_BUTTON_QUIT, myFrame::OnQuitButton)
wxEND_EVENT_TABLE()

myFrame::myFrame(const wxString title):wxFrame(NULL,wxID_ANY,title)
{
	SetWindowStyleFlag(wxFRAME_NO_TASKBAR | wxNO_BORDER);  
	wxButton* m_button1 = new wxButton(this, ID_BUTTON_QUIT, wxT("提示"), wxDefaultPosition, wxDefaultSize, 0);
}

void myFrame::OnQuitButton(wxCommandEvent &event)
{
	wxMessageBox(wxT("hoho"), wxT("Message"),wxYES|wxNO,this);
}
请教下是什么原因?该如何解决?谢谢了!