VC++,与 wxWidgets 的链接错误,x64
VC++, linking error with wxWidgets, x64
我正在使用wxWidgets 2.8在Windows 7 x64上编译VC++ 10应用程序。这就是我遇到的错误。代码是使用 wxFormBuilder 生成的。
更新:我也尝试在 32 位机器上运行它,但仍然遇到同样的问题。
我不知道我错过了哪些wxwidgets库,或者我做错了哪些设置。已在调试和发布模式下尝试。
如果有人能指出一些提示,我将不胜感激!这个问题已经研究了一段时间。
1>WelcomeDlg.obj : error LNK2001: unresolved external symbol "class wxPoint const wxDefaultPosition" (?wxDefaultPosition@@3VwxPoint@@B)
1>ConsoleDlg.obj : error LNK2001: unresolved external symbol "class wxPoint const wxDefaultPosition" (?wxDefaultPosition@@3VwxPoint@@B)
1>ControlDialog.obj : error LNK2019: unresolved external symbol "class wxPoint const wxDefaultPosition" (?wxDefaultPosition@@3VwxPoint@@B) referenced in function "public: void __cdecl ControlDialog::loadFile(class std::basic_string,class std::allocator >)" (?loadFile@ControlDialog@@QEAAXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>WxWidgetsWindow.obj : error LNK2001: unresolved external symbol "class wxPoint const wxDefaultPosition" (?wxDefaultPosition@@3VwxPoint@@B)
1>MainFrame.obj : error LNK2001: unresolved external symbol "class wxPoint const wxDefaultPosition" (?wxDefaultPosition@@3VwxPoint@@B)
1>MainFrame.obj : error LNK2019: unresolved external symbol "public: static unsigned __int64 const wxStringBase::npos" (?npos@wxStringBase@@2_KB) referenced in function "public: __cdecl MainFrame::MainFrame(class wxWindow *,class UIApp *)" (??0MainFrame@@QEAA@PEAVwxWindow@@PEAVUIApp@@@Z)
1>UIApp.obj : error LNK2001: unresolved external symbol "public: static unsigned __int64 const wxStringBase::npos" (?npos@wxStringBase@@2_KB)
1>VISUI.obj : error LNK2001: unresolved external symbol "public: static unsigned __int64 const wxStringBase::npos" (?npos@wxStringBase@@2_KB)
1>WelcomeDlg.obj : error LNK2001: unresolved external symbol "public: static unsigned __int64 const wxStringBase::npos" (?npos@wxStringBase@@2_KB)
1>ConsoleDlg.obj : error LNK2001: unresolved external symbol "public: static unsigned __int64 const wxStringBase::npos" (?npos@wxStringBase@@2_KB)
1>ControlDialog.obj : error LNK2001: unresolved external symbol "public: static unsigned __int64 const wxStringBase::npos" (?npos@wxStringBase@@2_KB)
1>Helper.obj : error LNK2001: unresolved external symbol "public: static unsigned __int64 const wxStringBase::npos" (?npos@wxStringBase@@2_KB)
1>WxWidgetsWindow.obj : error LNK2001: unresolved external symbol "public: static unsigned __int64 const wxStringBase::npos" (?npos@wxStringBase@@2_KB)
1>MainFrame.obj : error LNK2001: unresolved external symbol "char const * const wxEmptyString" (?wxEmptyString@@3PEBDEB)
1>UIApp.obj : error LNK2001: unresolved external symbol "char const * const wxEmptyString" (?wxEmptyString@@3PEBDEB)
1>VISUI.obj : error LNK2001: unresolved external symbol "char const * const wxEmptyString" (?wxEmptyString@@3PEBDEB)
1>WelcomeDlg.obj : error LNK2001: unresolved external symbol "char const * const wxEmptyString" (?wxEmptyString@@3PEBDEB)
1>ConsoleDlg.obj : error LNK2001: unresolved external symbol "char const * const wxEmptyString" (?wxEmptyString@@3PEBDEB)
1>ControlDialog.obj : error LNK2001: unresolved external symbol "char const * const wxEmptyString" (?wxEmptyString@@3PEBDEB)
1>Helper.obj : error LNK2001: unresolved external symbol "char const * const wxEmptyString" (?wxEmptyString@@3PEBDEB)
1>WxWidgetsWindow.obj : error LNK2001: unresolved external symbol "char const * const wxEmptyString" (?wxEmptyString@@3PEBDEB)
1>ControlDialog.obj : error LNK2001: unresolved external symbol "class wxMBConvUTF8 & wxConvUTF8" (?wxConvUTF8@@3AEAVwxMBConvUTF8@@EA)
1>Helper.obj : error LNK2001: unresolved external symbol "class wxMBConvUTF8 & wxConvUTF8" (?wxConvUTF8@@3AEAVwxMBConvUTF8@@EA)
1>WxWidgetsWindow.obj : error LNK2001: unresolved external symbol "protected: static struct wxEventTable const wxGLCanvas::sm_eventTable" (?sm_eventTable@wxGLCanvas@@1UwxEventTable@@B)
1>WxWidgetsWindow.obj : error LNK2001: unresolved external symbol "char const * const wxFrameNameStr" (?wxFrameNameStr@@3QBDB)
1>VISUI.obj : error LNK2001: unresolved external symbol "char const * const wxFrameNameStr" (?wxFrameNameStr@@3QBDB)
1>WxWidgetsWindow.obj : error LNK2001: unresolved external symbol "class wxPalette wxNullPalette" (?wxNullPalette@@3VwxPalette@@A)
1>WxWidgetsWindow.obj : error LNK2001: unresolved external symbol "class wxCursor wxNullCursor" (?wxNullCursor@@3VwxCursor@@A)
1>WxWidgetsWindow.obj : error LNK2001: unresolved external symbol "int const wxEVT_NULL" (?wxEVT_NULL@@3HB)
1>WxWidgetsWindow.obj : error LNK2001: unresolved external symbol "int const wxEVT_ERASE_BACKGROUND" (?wxEVT_ERASE_BACKGROUND@@3HB)
1>WxWidgetsWindow.obj : error LNK2001: unresolved external symbol "int const wxEVT_PAINT" (?wxEVT_PAINT@@3HB)
1>WxWidgetsWindow.obj : error LNK2001: unresolved external symbol "int const wxEVT_SIZE" (?wxEVT_SIZE@@3HB)
1>WxWidgetsWindow.obj : error LNK2001: unresolved external symbol "int const wxEVT_IDLE" (?wxEVT_IDLE@@3HB)
The libraries I'm linking against (64-bit wxwidgets libraries)
wxbase28.lib
wxmsw28_core.lib
wxmsw28_richtext.lib
wxmsw28_html.lib
wxmsw28_gl.lib
wxmsw28_adv.lib
comctl32.lib
Rpcrt4.lib
My compiling settings:
- Treat Wchat_t as built in type: Yes
- Multi-threaded Debug DLL
I found the solution to my own problem. Just post here in case anyone faces it.
It's not about x64 or x32, neither about wxWidgets. I just need to add these 2 lines in header (before #include <wx/wx.h>
)
#define __WXMSW__
#define WXUSINGDLL
你是如何构建wxWidgets的?我的理解是,您必须更改与wxWidgets一起分发的Visual Studio项目文件,以便它以64位模式构建。除非您的目标是 32 位模式。因此,请确保您的应用程序和 wxWidget 的目标架构相同(即两者都应该是 32 位或 64 位)。
另外,最后我看了一下,wxWidgets 2.8不支持x64,如果你想以x64为目标,你需要升级到wxWidgets 2.9。
您还可以查看以下链接:http://wiki.wxwidgets.org/Supporting_x64_and_Win32_within_one_solution
1>WelcomeDlg.obj : error LNK2001: unresolved external symbol "class wxPoint const wxDefaultPosition" (?wxDefaultPosition@@3VwxPoint@@B)
这是一个极其奇怪的外部符号。 "类"在那里做什么 - 这是一个C++关键词。 所有的空间都在做什么?
我的猜测是编译过程中发生了一些可怕的事情。 您确定您甚至将源代码提交给了C++编译器吗?
在 MSVC 2019 上遇到了相同的问题,如尝试从站点下载的预编译二进制文件构建时的问题中所述。当我使用"发布"选项(不是"发布 DLL",而是"发布")从...buildmswwx_vc12.sln
源代码编译并获得"vc_x64_lib"文件夹时,一切正常。就我而言,无需指定#define __WXMSW__
和#define WXUSINGDLL
,只需检查您使用Multi-threaded DLL (/MD)
构建
- C++ OPENCV 4.3.0 x64 为什么face_cascade抛出错误?
- 解决与构建"Debug x64"版本的暗网相关的错误
- C++ Boost::asio x64 async_send失败,出现错误 10014 (WSAEFAULT)
- 在 Ubuntu 17.04 x64 下使用 SpiderMonkey (libmozjs-45.0.2) 的分段错误
- 致命错误LNK1112:在 npm 安装期间,模块计算机类型'X86'与目标计算机类型'x64'冲突
- 库将ARM架构错误编译为架构X64
- LNK2001在X64环境中的编译代码上看到的错误.但是,该代码在X86环境中填充了罚款
- 致命错误LNK1112:通过 vcvarsall .bat x86 运行构建'X86'模块计算机类型'x64'与目标计算机类型冲突
- 为什么从 win32 项目链接到 x64 库时会出现链接错误
- QtGui4.lib(QtGui4.dll):致命错误LNK1112:模块计算机类型"X86"与目标计算机类型"x64"冲突
- MSVC11 错误中的 x64 位 asm
- 非常简单的 x64 组装/C++应用程序中未解决的外部错误
- QuantLib 1.5 编译错误无法打开文件'QuantLib-vc100-x64-mt.lib'
- std::tr1::函数为VS2008 SP1中的x64配置提供链接错误
- 数组大小错误 x64 进程
- JNI 在具有 x86javapath 的 x64 计算机上的 x86java 上出现未满足的链接错误
- crt1.o Linux x64 上没有这样的文件 C++ 编译错误
- x64 上的 Boost 1.60 和 VS 2013 的链接器错误
- 错误 MSB8007:项目 XXX 的平台无效。平台='x64'
- x64上的WMI链接器错误