gpt4 book ai didi

c++ - 为什么 wxWidgets 不能与 Code::Blocks + minGW 一起工作?

转载 作者:行者123 更新时间:2023-11-28 07:58:44 25 4
gpt4 key购买 nike

我如何使 wxWidgets 2.9.4 与 Code::Blocks + MinGW 一起工作?我已经构建了库(仅发布)并编写了一些代码。当我不使用事件表构建它时,它工作正常,但使用它们时,它会抛出错误。

这里是有事件表时构建消息的转储:

obj\Debug\main.o||In function `_ZN21wxEventTableEntryBaseC2EiiP14wxEventFunctorP8wxObject':|
C:\wxWidgets\include\wx\event.h|2870|undefined reference to `_wxTheAssertHandler'|
C:\wxWidgets\include\wx\event.h|2871|undefined reference to `wxOnAssert(char const*, int, char const*, char const*, char const*)'|
obj\Debug\main.o||In function `_ZN20wxEventFunctorMethodI14wxEventTypeTagI14wxCommandEventE12wxEvtHandler7wxEventS3_EC1EMS3_FvRS4_EPS3_':|
C:\wxWidgets\include\wx\event.h|374|undefined reference to `_wxTheAssertHandler'|
C:\wxWidgets\include\wx\event.h|374|undefined reference to `wxOnAssert(char const*, int, char const*, char const*, char const*)'|
obj\Debug\main.o||In function `_ZN20wxEventFunctorMethodI14wxEventTypeTagI14wxCommandEventE12wxEvtHandler7wxEventS3_EclEPS3_RS4_':|
C:\wxWidgets\include\wx\event.h|392|undefined reference to `_wxTheAssertHandler'|
C:\wxWidgets\include\wx\event.h|392|undefined reference to `wxOnAssert(char const*, int, char const*, char const*, char const*)'|
||=== Build finished: 6 errors, 0 warnings ===|

和另一个构建日志:

-------------- Build: Debug in G1BC ---------------

Compiling: main.cpp
Linking executable: bin\Debug\G1BC.exe
obj\Debug\main.o: In function `_ZN21wxEventTableEntryBaseC2EiiP14wxEventFunctorP8wxObject':
C:/wxWidgets/include/wx/event.h:2870: undefined reference to `_wxTheAssertHandler'
C:/wxWidgets/include/wx/event.h:2871: undefined reference to `wxOnAssert(char const*, int, char const*, char const*, char const*)'
obj\Debug\main.o: In function `_ZN20wxEventFunctorMethodI14wxEventTypeTagI14wxCommandEventE12wxEvtHandler7wxEventS3_EC1EMS3_FvRS4_EPS3_':
C:/wxWidgets/include/wx/event.h:374: undefined reference to `_wxTheAssertHandler'
C:/wxWidgets/include/wx/event.h:374: undefined reference to `wxOnAssert(char const*, int, char const*, char const*, char const*)'
obj\Debug\main.o: In function `_ZN20wxEventFunctorMethodI14wxEventTypeTagI14wxCommandEventE12wxEvtHandler7wxEventS3_EclEPS3_RS4_':
C:/wxWidgets/include/wx/event.h:392: undefined reference to `_wxTheAssertHandler'
C:/wxWidgets/include/wx/event.h:392: undefined reference to `wxOnAssert(char const*, int, char const*, char const*, char const*)'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 4 seconds)
6 errors, 0 warnings

Code::Blocks 说这段代码是问题所在: The bad code

希望您能提供帮助,在此先感谢!

最佳答案

您需要始终将 DEBUG_FLAG=1 保留为 that,否则断言将无法编译。

这是 MSW 的 install.txt 中的内容:

Specifies the level of debug support in wxWidgets. Notice that this is independent from both BUILD and DEBUG_INFO options. By default always set to 1 meaning that > debug support is enabled: asserts are compiled into the code (they are inactive by default in release builds of the application but can be enabled), wxLogDebug() and wxLogTrace() are available and WXDEBUG is defined. Setting it to 0 completely disables all debugging code in wxWidgets while setting it to 2 enables even the time consuming assertions and checks which are deemed to be unsuitable for production environment.

关于c++ - 为什么 wxWidgets 不能与 Code::Blocks + minGW 一起工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12059616/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com