静态链接 wxWidgets 时的引用错误
Reference errors when linking wxWidgets statically
我在构建脚本中将这个Premake4脚本用于wxWidgets:
wx_config {Unicode="yes", Version="2.9", Libs="core,aui,media,html", WindowsCompiler="gcc", Static="yes"}
但 CodeBlocks 分别输出 MinGW 的许多错误:
wxlibgcc_lib/libwxbase29u.a(baselib_filename.o):filename.cpp:(.text+0x5371): undefined reference to `CoCreateInstance@20'
wxlibgcc_lib/libwxbase29u.a(baselib_filename.o):filename.cpp:(.text+0x5390): undefined reference to `IID_IPersistFile'
wxlibgcc_lib/libwxmsw29u_core.a(corelib_window.o):window.cpp:(.text+0x7cc9): undefined reference to `wxEVT_POWER_SUSPEND_CANCEL'
wxlibgcc_lib/libwxmsw29u_core.a(corelib_window.o):window.cpp:(.text+0x7cf9): undefined reference to `vtable for wxPowerEvent'
wxlibgcc_lib/libwxmsw29u_core.a(corelib_window.o):window.cpp:(.text+0x7d55): undefined reference to `wxEVT_POWER_SUSPENDED'
wxlibgcc_lib/libwxmsw29u_core.a(corelib_window.o):window.cpp:(.text+0x7d61): undefined reference to `wxEVT_POWER_SUSPENDING'
wxlibgcc_lib/libwxmsw29u_core.a(corelib_window.o):window.cpp:(.text+0x7d6d): undefined reference to `wxEVT_POWER_RESUME'
wxlibgcc_lib/libwxmsw29u_core.a(corelib_window.o):window.cpp:(.text+0x7f18): undefined reference to `vtable for wxPowerEvent'
...
您可以在此处查看所有链接器错误:http://pastebin.com/UGSRg4DX
有人在wxWidgets错误报告(链接丢失)中提到库顺序导致了这个问题。但他没有说必须首先放置哪个图书馆。
这看起来像是与此完全相同的问题。 也就是说,您需要以正确的顺序将库放入预制脚本中:aui,media,html,core
(重要的是"核心"是最后一个)。另外,我不知道它是否隐式附加,但通常您还需要在最后附加"base"。
相关文章:
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- C++引用错误
- 已定义函数时出现 G++ "未定义的引用"错误
- 链接 cmake 时出现未定义的引用错误
- 只有级联分类器会发出未定义的引用错误
- 2个模板化类的非模板友元函数未定义引用错误
- C/C++ 取消引用错误:在空检查之前取消引用
- 为什么我的C++代码无法编译,出现未定义的引用错误
- 我的代码中C++未定义的引用错误?
- 模板专用化会导致未定义的引用错误
- .cpp文件中未定义的引用错误
- c++ 中目录中文件的未定义引用错误
- Opencv4 使用 pkg-config 给出未定义的引用错误
- 使用Cygwin C++时出现未定义的引用错误,为什么我的文件没有链接?
- 共享指针取消引用错误
- 编译简单的多文件类程序时出现未定义的引用错误
- 模板函数产生未定义的引用错误
- 调用提取重加载器会产生对"运算符"的未定义引用错误>>
- 如何修复"未定义的引用"错误 opencv 和 g++
- 未定义的引用错误,我该怎么办?