我如何让 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 说这段代码是问题所在:
希望能帮到你,先谢谢了!