VC++,与 wxWidgets 的链接错误,x64

发布于 2024-11-06 06:57:17 字数 5329 浏览 1 评论 0原文

我正在使用 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)

我链接的库(64 位 wxwidgets 库)

wxbase28.lib wxmsw28_core.lib wxmsw28_richtext.lib wxmsw28_html.lib wxmsw28_gl.lib wxmsw28_adv.lib comctl32.lib Rpcrt4.lib

我的编译设置:

  • 将 Wchat_t 视为内置类型:是
  • 多线程调试 DLL

I'm compiling a VC++ 10 application on Windows 7 x64 with wxWidgets 2.8. And this is the errors I have. The code is generated using wxFormBuilder.

Update: I try to run it on 32-bit machine as well, still having the same problem.

I have no idea which wxwidgets libraries I'm missing out, or what settings did I do it wrong. Tried both in Debug and Release mode.

I'd really appreciate if someone could point to some hints! Been looking at this problem for a while.


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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

墨小沫ゞ 2024-11-13 06:57:17

我找到了解决我自己问题的方法。只要在这里发帖以防有人遇到它。

这与 x64 或 x32 无关,也与 wxWidgets 无关。我只需要在标题中添加这两行(在 #include 之前)

#define __WXMSW__
#define WXUSINGDLL

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
复古式 2024-11-13 06:57:17

你是如何构建 wxWidgets 的?我的理解是,您必须更改随 wxWidgets 分发的 Visual Studio 项目文件,以便它以 64 位模式构建。除非您的目标是 32 位模式。因此,请确保您的应用程序和 wxWidgets 的目标架构相同(即两者都应该是 32 位或 64 位)。

另外,最后我看到,wxWidgets 2.8不支持x64,如果你想针对x64,你需要升级到wxWidgets 2.9。

您还可以查看以下链接:http://wiki.wxwidgets.org/Supporting_x64_and_Win32_within_one_solution

How did you build wxWidgets? My understanding is that you will have to change the Visual Studio projects files distributed with wxWidgets, so that it builds in 64-bit mode. Unless you are targeting 32-bit mode. So make sure that you are targeting the same architecture with both your application and wxWidgets (i.e. both should be either 32 or 64 bit).

Also, last I looked, wxWidgets 2.8 doesn't support x64, you will need to upgrade to wxWidgets 2.9 if you want to target x64.

You can also check out the following link: http://wiki.wxwidgets.org/Supporting_x64_and_Win32_within_one_solution

暗藏城府 2024-11-13 06:57:17
1>WelcomeDlg.obj : error LNK2001: unresolved external symbol "class wxPoint const wxDefaultPosition" (?wxDefaultPosition@@3VwxPoint@@B)

这是一个极其奇怪的外在符号。 “class”在那里做什么——它是一个 C++ 关键字。所有的空间都在做什么?

我的猜测是编译期间发生了一些可怕的事情。您确定您已将源代码提交给 C++ 编译器吗?

1>WelcomeDlg.obj : error LNK2001: unresolved external symbol "class wxPoint const wxDefaultPosition" (?wxDefaultPosition@@3VwxPoint@@B)

This is an extremely strange external symbol. What is 'class' doing there - it is a C++ keyword. What are all the spaces doing?

My guess is that something horrible happened during compilation. Are you certain you even submitted your source code to a C++ compiler?

小忆控 2024-11-13 06:57:17

当尝试从网站下载的预编译二进制文件进行构建时,在 MSVC 2019 上遇到了与问题中所述相同的问题。
当我使用“Release”选项(不是“Release DLL”,而是“Release”)从 ...\build\msw\wx_vc12.sln 源代码进行编译并获取“vc_x64_lib”文件夹时,一切正常。在我的情况下,不需要指定 #define __WXMSW__#define WXUSINGDLL,只需检查您使用多线程 DLL (/MD) 进行构建即可

Had the same problems on MSVC 2019 as described in the question when try to build from precompiled binaries downloaded from site.
When I compiled from source from ...\build\msw\wx_vc12.sln with "Release" option (NOT "Release DLL", but "Release") and get "vc_x64_lib" folder everything works. In my case no needs specify #define __WXMSW__ and #define WXUSINGDLL, just check you build with Multi-threaded DLL (/MD)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文