简体   繁体   English

静态链接wxWidgets时的引用错误

[英]Reference errors when linking wxWidgets statically

I'm using this Premake4 script for wxWidgets in my build script: 我在构建脚本中为wxWidgets使用了这个Premake4脚本:

wx_config {Unicode="yes", Version="2.9", Libs="core,aui,media,html", WindowsCompiler="gcc", Static="yes"}

But CodeBlocks respectively MinGW outputs many errors: 但是CodeBlocks分别MinGW会输出很多错误:

wx\lib\gcc_lib/libwxbase29u.a(baselib_filename.o):filename.cpp:(.text+0x5371): undefined reference to `CoCreateInstance@20'
wx\lib\gcc_lib/libwxbase29u.a(baselib_filename.o):filename.cpp:(.text+0x5390): undefined reference to `IID_IPersistFile'
wx\lib\gcc_lib/libwxmsw29u_core.a(corelib_window.o):window.cpp:(.text+0x7cc9): undefined reference to `wxEVT_POWER_SUSPEND_CANCEL'
wx\lib\gcc_lib/libwxmsw29u_core.a(corelib_window.o):window.cpp:(.text+0x7cf9): undefined reference to `vtable for wxPowerEvent'
wx\lib\gcc_lib/libwxmsw29u_core.a(corelib_window.o):window.cpp:(.text+0x7d55): undefined reference to `wxEVT_POWER_SUSPENDED'
wx\lib\gcc_lib/libwxmsw29u_core.a(corelib_window.o):window.cpp:(.text+0x7d61): undefined reference to `wxEVT_POWER_SUSPENDING'
wx\lib\gcc_lib/libwxmsw29u_core.a(corelib_window.o):window.cpp:(.text+0x7d6d): undefined reference to `wxEVT_POWER_RESUME'
wx\lib\gcc_lib/libwxmsw29u_core.a(corelib_window.o):window.cpp:(.text+0x7f18): undefined reference to `vtable for wxPowerEvent'
...

You can see all linker errors here: http://pastebin.com/UGSRg4DX 您可以在此处查看所有链接器错误: http//pastebin.com/UGSRg4DX

Someone mentioned in a wxWidgets bug report (link lost) that the library order is causing this problem. 有人在wxWidgets错误报告(链接丢失)中提到库顺序导致了这个问题。 But he didn't say which library has to be put first. 但他没有说哪个库必须先放。

This looks like exactly the same problem as this one . 这看起来完全一样的问题,因为这一个 Ie you need to put the libraries in your premake script in the right order: aui,media,html,core (the important thing is that "core" is the last one). 即你需要以正确的顺序将库放在你的预制脚本中: aui,media,html,core (重要的是“核心”是最后一个)。 Also, I don't know if it's appended implicitly perhaps but normally you'd also need "base" at the very end. 另外,我不知道它是否隐含地附加了,但通常你最后也需要“基础”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何调试链接器错误? 静态链接ICU时获取未定义的引用错误 - How to debug linker errors? Getting undefined reference errors when statically linking ICU 与gcc静态链接时,“对dlopen的未定义引用” - “Undefined reference to dlopen” when statically linking with gcc 静态链接 GLFW 时对“__ms_vsnprintf”的未定义引用 - Undefined reference to `__ms_vsnprintf' when linking GLFW statically 使用wxWidgets(3.0.2)进行静态构建时出现许多未定义的参考错误 - A lot of undefined reference errors when using wxWidgets(3.0.2) as static build 静态链接MFC时未修改的Visual Studio 2012 MFC模板中的链接错误 - Link Errors in Unmodified Visual Studio 2012 MFC Template when Statically Linking MFC 在Linux上将自定义Apache 2.4模块与httpd / apr库静态链接时出现错误 - Errors when linking a custom Apache 2.4 modules statically with httpd/apr libraries on Linux 未定义引用(链接错误) - Undefined Reference To (linking errors) 静态链接到libzbar.a时出错:未定义引用`_imp__GetACP @ 0' - Error when statically-linking to libzbar.a: undefined reference to `_imp__GetACP@0' 链接Qt应用程序时出现数百个“未定义参考”错误 - Hundreds of “undefined reference” errors when linking Qt application 与 raspicam 库链接时,链接器/加载器错误“未定义引用...” - Linker/loader errors "undefined reference to ..." when linking with raspicam library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM