User forums > Help
Please help with wxWidgets 3.0.2 and GNU compiler
codeman_nz:
I am at my wits end and I have no idea how to fix this.
I built wxidgets using these commands:
mingw32-make -f makefile.gcc CXXFLAGS="-std=gnu++11" BUILD=debug UNICODE=0 SHARED=0
mingw32-make -f makefile.gcc CXXFLAGS="-std=gnu++11" BUILD=release UNICODE=0 SHARED=0
and then I created a new wxwidgets project. I chose None as my preferred builder and frame based application type and I did not select any configuration settings. But when I compile I get a whole bunch of undefined reference errors. Full build log below:
-------------- Clean: Debug in test (compiler: GNU GCC Compiler)---------------
Cleaned "test - Debug"
-------------- Build: Debug in test (compiler: GNU GCC Compiler)---------------
windres.exe -IC:\wxWidgets-3.0.2\include -IC:\wxWidgets-3.0.2\lib\gcc_lib\mswd -J rc -O coff -i C:\Users\snolan\Desktop\test\resource.rc -o obj\Debug\resource.res
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -Wall -g -D__WXDEBUG__ -IC:\wxWidgets-3.0.2\lib\gcc_lib\mswd -IC:\wxWidgets-3.0.2\include -I"C:\Program Files (x86)\CodeBlocks\MinGW\include\common" -c C:\Users\snolan\Desktop\test\testApp.cpp -o obj\Debug\testApp.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -Wall -g -D__WXDEBUG__ -IC:\wxWidgets-3.0.2\lib\gcc_lib\mswd -IC:\wxWidgets-3.0.2\include -I"C:\Program Files (x86)\CodeBlocks\MinGW\include\common" -c C:\Users\snolan\Desktop\test\testMain.cpp -o obj\Debug\testMain.o
mingw32-g++.exe -LC:\wxWidgets-3.0.2\lib\gcc_lib -LC:\Users\snolan\Downloads\lib -o bin\Debug\test.exe obj\Debug\testApp.o obj\Debug\testMain.o obj\Debug\resource.res -mthreads -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -lwxmsw30d_core -lwxbase30d -lwxpngd -lwxzlibd -mwindows
obj\Debug\testApp.o: In function `WinMain@16':
C:/Users/snolan/Desktop/test/testApp.cpp:21: undefined reference to `wxEntry(HINSTANCE__*, HINSTANCE__*, char*, int)'
obj\Debug\testApp.o: In function `Z11wxCreateAppv':
C:/Users/snolan/Desktop/test/testApp.cpp:21: undefined reference to `wxAppConsoleBase::CheckBuildOptions(char const*, char const*)'
obj\Debug\testApp.o: In function `ZN7testApp6OnInitEv':
C:/Users/snolan/Desktop/test/testApp.cpp:26: undefined reference to `wxIcon::wxIcon(wxString const&, wxBitmapType, int, int)'
C:/Users/snolan/Desktop/test/testApp.cpp:26: undefined reference to `wxTopLevelWindowBase::SetIcon(wxIcon const&)'
C:/Users/snolan/Desktop/test/testApp.cpp:26: undefined reference to `wxIcon::~wxIcon()'
C:/Users/snolan/Desktop/test/testApp.cpp:26: undefined reference to `wxIcon::~wxIcon()'
obj\Debug\testApp.o: In function `Z16wxGet_wxConvLibcv':
C:/wxWidgets-3.0.2/include/wx/strconv.h:576: undefined reference to `wxConvLibcPtr'
C:/wxWidgets-3.0.2/include/wx/strconv.h:576: undefined reference to `wxGet_wxConvLibcPtr()'
C:/wxWidgets-3.0.2/include/wx/strconv.h:576: undefined reference to `wxConvLibcPtr'
C:/wxWidgets-3.0.2/include/wx/strconv.h:576: undefined reference to `wxConvLibcPtr'
obj\Debug\testApp.o: In function `ZN8wxString7ImplStrEPKcRK8wxMBConv':
C:/wxWidgets-3.0.2/include/wx/string.h:477: undefined reference to `wxString::npos'
C:/wxWidgets-3.0.2/include/wx/string.h:477: undefined reference to `wxString::ConvertStr(char const*, unsigned int, wxMBConv const&)'
obj\Debug\testApp.o: In function `ZN8wxObjectaSERKS_':
C:/wxWidgets-3.0.2/include/wx/object.h:374: undefined reference to `wxObject::Ref(wxObject const&)'
obj\Debug\testApp.o: In function `ZN23wxCriticalSectionLockerC1ER17wxCriticalSection':
C:/wxWidgets-3.0.2/include/wx/thread.h:307: undefined reference to `wxCriticalSection::Enter()'
obj\Debug\testApp.o: In function `ZN23wxCriticalSectionLockerD1Ev':
C:/wxWidgets-3.0.2/include/wx/thread.h:312: undefined reference to `wxCriticalSection::Leave()'
obj\Debug\testApp.o: In function `ZN12wxEvtHandler9TryParentER7wxEvent':
C:/wxWidgets-3.0.2/include/wx/event.h:3685: undefined reference to `wxEvtHandler::DoTryApp(wxEvent&)'
obj\Debug\testApp.o: In function `Z16wxGetTranslationRK8wxStringS1_':
C:/wxWidgets-3.0.2/include/wx/translation.h:246: undefined reference to `wxTranslations::Get()'
C:/wxWidgets-3.0.2/include/wx/translation.h:248: undefined reference to `wxTranslations::GetTranslatedString(wxString const&, wxString const&) const'
C:/wxWidgets-3.0.2/include/wx/translation.h:254: undefined reference to `wxTranslations::GetUntranslatedString(wxString const&)'
obj\Debug\testApp.o: In function `ZN16wxAppConsoleBase22SetInitializerFunctionEPFP12wxAppConsolevE':
C:/wxWidgets-3.0.2/include/wx/app.h:431: undefined reference to `wxAppConsoleBase::ms_appInitFn'
obj\Debug\testApp.o: In function `ZN16wxAppConsoleBase11GetInstanceEv':
C:/wxWidgets-3.0.2/include/wx/app.h:439: undefined reference to `wxAppConsoleBase::ms_appInstance'
obj\Debug\testApp.o: In function `ZNK12wxWindowBase18GetBestVirtualSizeEv':
C:/wxWidgets-3.0.2/include/wx/window.h:530: undefined reference to `wxWindowBase::GetBestSize() const'
obj\Debug\testApp.o: In function `ZNK12wxWindowBase12CanBeFocusedEv':
C:/wxWidgets-3.0.2/include/wx/window.h:744: undefined reference to `wxWindowBase::IsEnabled() const'
obj\Debug\testApp.o: In function `ZN12wxWindowBase25ProcessWindowEventLocallyER7wxEvent':
C:/wxWidgets-3.0.2/include/wx/window.h:876: undefined reference to `wxEvtHandler::ProcessEventLocally(wxEvent&)'
obj\Debug\testApp.o: In function `ZNK12wxWindowBase10HasCaptureEv':
C:/wxWidgets-3.0.2/include/wx/window.h:996: undefined reference to `wxWindowBase::GetCapture()'
obj\Debug\testApp.o: In function `ZNK12wxWindowBase20GetDefaultAttributesEv':
C:/wxWidgets-3.0.2/include/wx/window.h:1067: undefined reference to `wxWindowBase::GetClassDefaultAttributes(wxWindowVariant)'
obj\Debug\testApp.o: In function `ZNK12wxWindowBase19DoGetBestClientSizeEv':
C:/wxWidgets-3.0.2/include/wx/window.h:1746: undefined reference to `wxDefaultSize'
C:/wxWidgets-3.0.2/include/wx/window.h:1746: undefined reference to `wxDefaultSize'
obj\Debug\testApp.o: In function `ZN12wxWindowBase18SetInitialBestSizeERK6wxSize':
C:/wxWidgets-3.0.2/include/wx/window.h:1874: undefined reference to `wxWindowBase::SetInitialSize(wxSize const&)'
obj\Debug\testApp.o: In function `ZN8wxWindowC2Ev':
C:/wxWidgets-3.0.2/include/wx/msw/window.h:40: undefined reference to `wxWindowBase::wxWindowBase()'
C:/wxWidgets-3.0.2/include/wx/msw/window.h:40: undefined reference to `vtable for wxWindow'
C:/wxWidgets-3.0.2/include/wx/msw/window.h:40: undefined reference to `wxWindow::Init()'
C:/wxWidgets-3.0.2/include/wx/msw/window.h:40: undefined reference to `wxWindowBase::~wxWindowBase()'
obj\Debug\testApp.o: In function `ZN8wxWindow14ShowWithEffectE12wxShowEffectj':
C:/wxWidgets-3.0.2/include/wx/msw/window.h:76: undefined reference to `wxWindow::MSWShowWithEffect(bool, wxShowEffect, unsigned int)'
obj\Debug\testApp.o: In function `ZN8wxWindow14HideWithEffectE12wxShowEffectj':
C:/wxWidgets-3.0.2/include/wx/msw/window.h:81: undefined reference to `wxWindow::MSWShowWithEffect(bool, wxShowEffect, unsigned int)'
obj\Debug\testApp.o: In function `ZN8wxWindow20MSWEndDeferWindowPosEv':
C:/wxWidgets-3.0.2/include/wx/msw/window.h:697: undefined reference to `wxDefaultPosition'
C:/wxWidgets-3.0.2/include/wx/msw/window.h:697: undefined reference to `wxDefaultPosition'
C:/wxWidgets-3.0.2/include/wx/msw/window.h:698: undefined reference to `wxDefaultSize'
C:/wxWidgets-3.0.2/include/wx/msw/window.h:698: undefined reference to `wxDefaultSize'
obj\Debug\testApp.o: In function `ZN20wxTopLevelWindowBase8IsActiveEv':
C:/wxWidgets-3.0.2/include/wx/toplevel.h:226: undefined reference to `wxWindowBase::FindFocus()'
C:/wxWidgets-3.0.2/include/wx/toplevel.h:226: undefined reference to `wxWindowBase::IsDescendant(wxWindowBase*) const'
obj\Debug\testApp.o: In function `ZN7wxFrame19MSWTranslateMessageEP6tagMSG':
C:/wxWidgets-3.0.2/include/wx/msw/frame.h:94: undefined reference to `wxFrame::MSWDoTranslateMessage(wxFrame*, tagMSG*)'
obj\Debug\testApp.o: In function `ZN20wxMDIParentFrameBaseD1Ev':
C:/wxWidgets-3.0.2/include/wx/mdi.h:58: undefined reference to `wxFrame::~wxFrame()'
C:/wxWidgets-3.0.2/include/wx/mdi.h:58: undefined reference to `wxFrame::~wxFrame()'
obj\Debug\testApp.o: In function `ZN21wxMDIClientWindowBaseD1Ev':
C:/wxWidgets-3.0.2/include/wx/mdi.h:322: undefined reference to `wxWindow::~wxWindow()'
obj\Debug\testApp.o: In function `ZN17wxMDIClientWindowC1Ev':
C:/wxWidgets-3.0.2/include/wx/msw/mdi.h:242: undefined reference to `vtable for wxMDIClientWindow'
obj\Debug\testApp.o: In function `ZN20wxMDIParentFrameBase9TryBeforeER7wxEvent':
C:/wxWidgets-3.0.2/include/wx/mdi.h:384: undefined reference to `wxEVT_MENU'
C:/wxWidgets-3.0.2/include/wx/mdi.h:385: undefined reference to `wxEVT_UPDATE_UI'
C:/wxWidgets-3.0.2/include/wx/mdi.h:394: undefined reference to `wxWindowBase::IsDescendant(wxWindowBase*) const'
C:/wxWidgets-3.0.2/include/wx/mdi.h:402: undefined reference to `wxWindowBase::TryBefore(wxEvent&)'
Process terminated with status 1 (0 minute(s), 7 second(s))
50 error(s), 0 warning(s) (0 minute(s), 7 second(s))
oBFusCATed:
I guess you'll have to add the wx libraries to the linker options that provide the missing symbols.
codeman_nz:
Well I just rebuilt wxwidgets as a monolithic library with unicode support and tried that but still get the same errors.
stahta01:
--- Quote from: codeman_nz on December 08, 2014, 12:58:08 am ---Well I just rebuilt wxwidgets as a monolithic library with unicode support and tried that but still get the same errors.
--- End quote ---
Then I suggest you use the newly built wxWidgets because if you really got the same errors you did NOT use it.
Edit: Without a full build log being posted you are just wasting everybody time with your posts.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
Edit2: Also post your configuration settings!!! The fact you did NOT choose any DOES NOT mean they are not settings!!!
Tim S.
codeman_nz:
I did use it. I can't count the number of times I have rebuilt it and use the newly built version but still get the same errors. here is the build output:
-------------- Clean: Release in test (compiler: GNU GCC Compiler)---------------
Cleaned "test - Release"
-------------- Build: Release in test (compiler: GNU GCC Compiler)---------------
windres.exe -IC:\wxWidgets-3.0.2\include -IC:\wxWidgets-3.0.2\lib\gcc_dll\mswu -J rc -O coff -i C:\Users\snolan\Desktop\test\resource.rc -o obj\Release\resource.res
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -O2 -IC:\wxWidgets-3.0.2\include -IC:\wxWidgets-3.0.2\lib\gcc_dll\mswu -I"C:\Program Files (x86)\CodeBlocks\MinGW\include\common" -c C:\Users\snolan\Desktop\test\testApp.cpp -o obj\Release\testApp.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -O2 -IC:\wxWidgets-3.0.2\include -IC:\wxWidgets-3.0.2\lib\gcc_dll\mswu -I"C:\Program Files (x86)\CodeBlocks\MinGW\include\common" -c C:\Users\snolan\Desktop\test\testMain.cpp -o obj\Release\testMain.o
mingw32-g++.exe -LC:\wxWidgets-3.0.2\lib\gcc_dll -LC:\Users\snolan\Downloads\lib -o bin\Release\test.exe obj\Release\testApp.o obj\Release\testMain.o obj\Release\resource.res -s -mthreads -lwxmsw30u -mwindows
obj\Release\testApp.o:testApp.cpp:(.text+0x4c): undefined reference to `wxAppConsoleBase::CheckBuildOptions(char const*, char const*)'
obj\Release\testApp.o:testApp.cpp:(.text+0x6b): undefined reference to `wxApp::wxApp()'
obj\Release\testApp.o:testApp.cpp:(.text+0xf3): undefined reference to `wxEntry(HINSTANCE__*, HINSTANCE__*, char*, int)'
obj\Release\testApp.o:testApp.cpp:(.text+0x101): undefined reference to `wxAppConsoleBase::ms_appInstance'
obj\Release\testApp.o:testApp.cpp:(.text+0x16f): undefined reference to `wxConvLibcPtr'
obj\Release\testApp.o:testApp.cpp:(.text+0x180): undefined reference to `wxString::npos'
obj\Release\testApp.o:testApp.cpp:(.text+0x19e): undefined reference to `wxString::ConvertStr(char const*, unsigned int, wxMBConv const&)'
obj\Release\testApp.o:testApp.cpp:(.text+0x1b3): undefined reference to `wxPrivate::GetUntypedNullData()'
obj\Release\testApp.o:testApp.cpp:(.text+0x1d2): undefined reference to `wxPrivate::GetUntypedNullData()'
obj\Release\testApp.o:testApp.cpp:(.text+0x203): undefined reference to `wxPrivate::GetUntypedNullData()'
obj\Release\testApp.o:testApp.cpp:(.text+0x236): undefined reference to `wxPrivate::GetUntypedNullData()'
obj\Release\testApp.o:testApp.cpp:(.text+0x267): undefined reference to `wxPrivate::GetUntypedNullData()'
obj\Release\testApp.o:testApp.cpp:(.text+0x27a): undefined reference to `wxTranslations::Get()'
obj\Release\testApp.o:testApp.cpp:(.text+0x29d): undefined reference to `wxTranslations::GetTranslatedString(wxString const&, wxString const&) const'
obj\Release\testApp.o:testApp.cpp:(.text+0x374): undefined reference to `wxIcon::wxIcon(wxString const&, wxBitmapType, int, int)'
obj\Release\testApp.o:testApp.cpp:(.text+0x38c): undefined reference to `wxTopLevelWindowBase::SetIcon(wxIcon const&)'
obj\Release\testApp.o:testApp.cpp:(.text+0x39e): undefined reference to `wxIcon::~wxIcon()'
obj\Release\testApp.o:testApp.cpp:(.text+0x436): undefined reference to `wxTranslations::GetUntranslatedString(wxString const&)'
obj\Release\testApp.o:testApp.cpp:(.text+0x4a8): undefined reference to `wxGet_wxConvLibcPtr()'
obj\Release\testApp.o:testApp.cpp:(.text+0x4ad): undefined reference to `wxConvLibcPtr'
obj\Release\testApp.o:testApp.cpp:(.text+0x509): undefined reference to `wxIcon::~wxIcon()'
obj\Release\testApp.o:testApp.cpp:(.text$_ZNK12wxWindowBase19DoGetBestClientSizeEv[__ZNK12wxWindowBase19DoGetBestClientSizeEv]+0xe0000011): undefined reference to `wxDefaultSize'
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: obj\Release\testApp.o: bad reloc address 0x1 in section `.text$_ZNK12wxWindowBase19DoGetBestClientSizeEv[__ZNK12wxWindowBase19DoGetBestClientSizeEv]'
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 6 second(s))
22 error(s), 0 warning(s) (0 minute(s), 6 second(s))
Here is the project file:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="test" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Release">
<Option output="bin/Release/test" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="0" />
<Option compiler="gcc" />
<Option projectLinkerOptionsRelation="2" />
<Compiler>
<Add option="-O2" />
<Add directory="C:/wxWidgets-3.0.2/lib/gcc_dll/mswu" />
</Compiler>
<ResourceCompiler>
<Add directory="C:/wxWidgets-3.0.2/lib/gcc_dll/mswu" />
</ResourceCompiler>
<Linker>
<Add option="-s" />
<Add library="libwxmsw30u.a" />
<Add directory="C:/wxWidgets-3.0.2/lib/gcc_dll" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-pipe" />
<Add option="-mthreads" />
<Add option="-D__GNUWIN32__" />
<Add option="-D__WXMSW__" />
<Add option="-DWXUSINGDLL" />
<Add option="-DwxUSE_UNICODE" />
<Add option="-Wall" />
<Add directory="C:/wxWidgets-3.0.2/include" />
</Compiler>
<ResourceCompiler>
<Add directory="C:/wxWidgets-3.0.2/include" />
</ResourceCompiler>
<Linker>
<Add option="-mthreads" />
</Linker>
<Unit filename="resource.rc">
<Option compilerVar="WINDRES" />
</Unit>
<Unit filename="testApp.cpp" />
<Unit filename="testApp.h" />
<Unit filename="testMain.cpp" />
<Unit filename="testMain.h" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>
Navigation
[0] Message Index
[#] Next page
Go to full version