wxWidgets在Code :: Blocks中的未定义引用

时间:2019-03-16 01:53:24

标签: codeblocks wxwidgets

我已经下载了wxWidgets 3.1.2的预构建二进制文件并将其放在我的minGW文件夹中。在Code::Blocks中,我运行用于创建wxWidgets应用程序的向导,只是为了检查wxWidgets是否正常工作。我开始构建该项目,并向我展示了一些纠正的错误。

但是我无法得到这些错误:

    ||=== Build: Debug in x (compiler: GNU GCC Compiler) ===|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o||in function `WinMain':|
C:\Users\Aadhish\Documents\Projects\x\xApp.cpp|17|undefined reference to `__imp__Z7wxEntryP11HINSTANCE__S0_Pci'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o||in function `xApp::OnInit()':|
C:\Users\Aadhish\Documents\Projects\x\xApp.cpp|23|undefined reference to `__imp__Z22wxInitAllImageHandlersv'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o||in function `xApp::xApp()':|
C:\Users\Aadhish\Documents\Projects\x\xApp.h|15|undefined reference to `__imp__ZN5wxAppC2Ev'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x10)||undefined reference to `wxApp::GetClassInfo() const'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x80)||undefined reference to `wxApp::GetEventTable() const'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x88)||undefined reference to `wxApp::GetEventHashTable() const'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0xb0)||undefined reference to `wxApp::Initialize(int&, wchar_t**)'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0xc8)||undefined reference to `wxAppBase::OnRun()'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0xe0)||undefined reference to `wxAppBase::OnExit()'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0xf0)||undefined reference to `wxApp::CleanUp()'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x108)||undefined reference to `wxAppBase::OnInitCmdLine(wxCmdLineParser&)'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x110)||undefined reference to `wxAppBase::OnCmdLineParsed(wxCmdLineParser&)'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x150)||undefined reference to `wxApp::OnExceptionInMainLoop()'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x190)||undefined reference to `wxApp::WakeUpIdle()'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x198)||undefined reference to `wxAppBase::ProcessIdle()'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x1b8)||undefined reference to `wxAppBase::CreateTraits()'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x1c0)||undefined reference to `wxAppBase::OnInitGui()'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x1c8)||undefined reference to `wxAppBase::SafeYield(wxWindow*, bool)'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x1d0)||undefined reference to `wxAppBase::SafeYieldFor(wxWindow*, long)'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x1e0)||undefined reference to `wxAppBase::GetTopWindow() const'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x1e8)||undefined reference to `wxAppBase::GetDisplayMode() const'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x200)||undefined reference to `wxAppBase::GetLayoutDirection() const'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o:xApp.cpp:(.rdata$_ZTV4xApp[_ZTV4xApp]+0x210)||undefined reference to `wxAppBase::SetActive(bool, wxWindow*)'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xApp.o||in function `xApp::~xApp()':|
C:\Users\Aadhish\Documents\Projects\x\xApp.h|15|undefined reference to `__imp__ZN5wxAppD2Ev'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xMain.o||in function `xFrame::xFrame(wxWindow*, int)':|
C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|64|undefined reference to `__imp_wxDefaultSize'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|64|undefined reference to `__imp_wxDefaultPosition'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|64|undefined reference to `__imp__ZN7wxFrame6CreateEP8wxWindowiRK8wxStringRK7wxPointRK6wxSizelS4_'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|65|undefined reference to `__imp__ZN9wxMenuBarC1Ev'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|67|undefined reference to `__imp__ZN10wxMenuItemC1EP6wxMenuiRK8wxStringS4_10wxItemKindS1_'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|71|undefined reference to `__imp__ZN10wxMenuItemC1EP6wxMenuiRK8wxStringS4_10wxItemKindS1_'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|74|undefined reference to `__imp__ZN11wxFrameBase10SetMenuBarEP9wxMenuBar'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|80|undefined reference to `__imp__ZN11wxFrameBase12SetStatusBarEP11wxStatusBar'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|82|undefined reference to `__imp_wxEVT_MENU'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|83|undefined reference to `__imp_wxEVT_MENU'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|55|undefined reference to `__imp__ZN7wxFrameD2Ev'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xMain.o||in function `xFrame::~xFrame()':|
C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|87|undefined reference to `__imp__ZN7wxFrameD2Ev'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xMain.o||in function `xFrame::OnQuit(wxCommandEvent&)':|
C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|95|undefined reference to `__imp__ZN12wxWindowBase5CloseEb'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xMain.o||in function `xFrame::OnAbout(wxCommandEvent&)':|
C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|101|undefined reference to `__imp__Z12wxMessageBoxRK8wxStringS1_lP8wxWindowii'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xMain.o||in function `__static_initialization_and_destruction_0':|
C:\Users\Aadhish\Documents\Projects\x\xMain.cpp|50|undefined reference to `__imp__ZN7wxFrame13sm_eventTableE'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xMain.o||in function `wxWindowBase::GetBestVirtualSize() const':|
C:\MinGW\include\wxwidgets\include\wx\window.h|525|undefined reference to `__imp__ZNK12wxWindowBase11GetBestSizeEv'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xMain.o||in function `wxWindowBase::CanBeFocused() const':|
C:\MinGW\include\wxwidgets\include\wx\window.h|738|undefined reference to `__imp__ZNK12wxWindowBase9IsEnabledEv'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xMain.o||in function `wxWindowBase::HasCapture() const':|
C:\MinGW\include\wxwidgets\include\wx\window.h|1032|undefined reference to `__imp__ZN12wxWindowBase10GetCaptureEv'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xMain.o||in function `wxWindowBase::GetDefaultAttributes() const':|
C:\MinGW\include\wxwidgets\include\wx\window.h|1113|undefined reference to `__imp__ZN12wxWindowBase25GetClassDefaultAttributesE15wxWindowVariant'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xMain.o||in function `wxWindowBase::DoGetBestClientSize() const':|
C:\MinGW\include\wxwidgets\include\wx\window.h|1817|undefined reference to `__imp_wxDefaultSize'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xMain.o||in function `wxWindow::ShowWithEffect(wxShowEffect, unsigned int)':|
C:\MinGW\include\wxwidgets\include\wx\msw\window.h|89|undefined reference to `__imp__ZN8wxWindow17MSWShowWithEffectEb12wxShowEffectj'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xMain.o||in function `wxWindow::HideWithEffect(wxShowEffect, unsigned int)':|
C:\MinGW\include\wxwidgets\include\wx\msw\window.h|94|undefined reference to `__imp__ZN8wxWindow17MSWShowWithEffectEb12wxShowEffectj'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xMain.o||in function `wxWindow::MSWEndDeferWindowPos()':|
C:\MinGW\include\wxwidgets\include\wx\msw\window.h|756|undefined reference to `__imp_wxDefaultPosition'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\MinGW\include\wxwidgets\include\wx\msw\window.h|757|undefined reference to `__imp_wxDefaultSize'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: obj\Debug\xMain.o||in function `wxTopLevelWindowBase::IsActive()':|
C:\MinGW\include\wxwidgets\include\wx\toplevel.h|201|undefined reference to `__imp__ZN12wxWindowBase9FindFocusEv'|
c:\mingw\bin\..\lib\gcc\x86_64-w64-mingw32\8.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\MinGW\include\wxwidgets\include\wx\toplevel.h|201|undefined reference to `__imp__ZNK12wxWindowBase12IsDescendantEPS_'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 2 second(s)) ===|

我得到了这些错误。我知道这是库的错误。我链接了libwxbase31ud.a.

希望我能解释一切。

1 个答案:

答案 0 :(得分:1)

您具有UI元素,因此也至少需要core库(即libwxmsw31ud_core.a)。 您可能会发现有一个Library List页面。然后,您可以转到libwxbase31ud.a当前所在的文件夹,以找到每个库的对应文件。

查找lib详细信息的另一个好地方是wxWidgets随附的示例的makefile.gcc