Author Topic: [SOLVED] CodeBlocks with wxWidgets compiler failed.  (Read 500 times)

Offline bleakwind

  • Single posting newcomer
  • *
  • Posts: 4
[SOLVED] CodeBlocks with wxWidgets compiler failed.
« on: August 20, 2019, 01:01:44 am »
I rebuild wxWidgets about 6,7 times, 2days, and it's still compiler failed.
Please help me...

My OS is Win7
codeblocks-17.12mingw-setup.exe
wxWidgets-3.1.2.zip



Here is compiler message:

Code: [Select]
-------------- Build: Debug in abc (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -g -ID:\wxWidgets\include -ID:\wxWidgets\lib\gcc_lib\mswu -c E:\Project\cb\abc\abcApp.cpp -o obj\Debug\abcApp.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -g -ID:\wxWidgets\include -ID:\wxWidgets\lib\gcc_lib\mswu -c E:\Project\cb\abc\abcMain.cpp -o obj\Debug\abcMain.o
windres.exe -ID:\wxWidgets\include -ID:\wxWidgets\lib\gcc_lib\mswu  -J rc -O coff -i E:\Project\cb\abc\resource.rc -o obj\Debug\resource.res
mingw32-g++.exe -LD:\wxWidgets\lib\gcc_lib -o bin\Debug\abc.exe obj\Debug\abcApp.o obj\Debug\abcMain.o  obj\Debug\resource.res -mthreads  -lwxmsw31u -lwxpng -lwxjpeg -lwxtiff -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -lshlwapi -lversion -mwindows
obj\Debug\abcApp.o: In function `WinMain@16':
E:/Project/cb/abc/abcApp.cpp:17: undefined reference to `wxEntry(HINSTANCE__*, HINSTANCE__*, char*, int)'
obj\Debug\abcApp.o: In function `Z11wxCreateAppv':
E:/Project/cb/abc/abcApp.cpp:17: undefined reference to `wxAppConsoleBase::CheckBuildOptions(char const*, char const*)'
obj\Debug\abcApp.o: In function `ZN6abcApp6OnInitEv':
E:/Project/cb/abc/abcApp.cpp:23: undefined reference to `wxInitAllImageHandlers()'
E:/Project/cb/abc/abcApp.cpp:28: undefined reference to `wxDialog::ShowModal()'
obj\Debug\abcApp.o: In function `ZN23wxCriticalSectionLockerC1ER17wxCriticalSection':
D:/wxWidgets/include/wx/thread.h:307: undefined reference to `wxCriticalSection::Enter()'
obj\Debug\abcApp.o: In function `ZN23wxCriticalSectionLockerD1Ev':
D:/wxWidgets/include/wx/thread.h:312: undefined reference to `wxCriticalSection::Leave()'
obj\Debug\abcApp.o: In function `ZN16wxAppConsoleBase22SetInitializerFunctionEPFP12wxAppConsolevE':
D:/wxWidgets/include/wx/app.h:454: undefined reference to `wxAppConsoleBase::ms_appInitFn'
obj\Debug\abcApp.o: In function `ZN16wxAppConsoleBase11GetInstanceEv':
D:/wxWidgets/include/wx/app.h:462: undefined reference to `wxAppConsoleBase::ms_appInstance'
obj\Debug\abcApp.o: In function `ZN6abcAppC1Ev':
E:/Project/cb/abc/abcApp.h:15: undefined reference to `wxApp::wxApp()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x8): undefined reference to `wxApp::GetClassInfo() const'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x14): undefined reference to `wxObject::CreateRefData() const'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x18): undefined reference to `wxObject::CloneRefData(wxRefCounter const*) const'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x24): undefined reference to `wxEvtHandler::ProcessEvent(wxEvent&)'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x28): undefined reference to `wxEvtHandler::QueueEvent(wxEvent*)'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x30): undefined reference to `wxEvtHandler::SearchEventTable(wxEventTable&, wxEvent&)'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x34): undefined reference to `wxEvtHandler::TryBefore(wxEvent&)'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x38): undefined reference to `wxEvtHandler::TryAfter(wxEvent&)'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x40): undefined reference to `wxApp::GetEventTable() const'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x44): undefined reference to `wxApp::GetEventHashTable() const'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x48): undefined reference to `wxEvtHandler::DoSetClientObject(wxClientData*)'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x4c): undefined reference to `wxEvtHandler::DoGetClientObject() const'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x50): undefined reference to `wxEvtHandler::DoSetClientData(void*)'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x54): undefined reference to `wxEvtHandler::DoGetClientData() const'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x58): undefined reference to `wxApp::Initialize(int&, wchar_t**)'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x64): undefined reference to `wxAppBase::OnRun()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x68): undefined reference to `wxAppConsoleBase::OnLaunched()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x70): undefined reference to `wxAppBase::OnExit()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x78): undefined reference to `wxApp::CleanUp()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x80): undefined reference to `wxAppConsoleBase::Exit()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x84): undefined reference to `wxAppBase::OnInitCmdLine(wxCmdLineParser&)'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x88): undefined reference to `wxAppBase::OnCmdLineParsed(wxCmdLineParser&)'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x8c): undefined reference to `wxAppConsoleBase::OnCmdLineHelp(wxCmdLineParser&)'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x90): undefined reference to `wxAppConsoleBase::OnCmdLineError(wxCmdLineParser&)'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x94): undefined reference to `wxAppConsoleBase::SetCLocale()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x98): undefined reference to `wxAppConsoleBase::FilterEvent(wxEvent&)'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0x9c): undefined reference to `wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0xa0): undefined reference to `wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0xa4): undefined reference to `wxAppConsoleBase::OnUnhandledException()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0xa8): undefined reference to `wxApp::OnExceptionInMainLoop()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0xac): undefined reference to `wxAppConsoleBase::StoreCurrentException()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0xb0): undefined reference to `wxAppConsoleBase::RethrowStoredException()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0xb4): undefined reference to `wxAppConsoleBase::ProcessPendingEvents()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0xb8): undefined reference to `wxAppConsoleBase::Pending()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0xbc): undefined reference to `wxAppConsoleBase::Dispatch()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0xc0): undefined reference to `wxAppConsoleBase::MainLoop()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0xc4): undefined reference to `wxAppConsoleBase::ExitMainLoop()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0xc8): undefined reference to `wxApp::WakeUpIdle()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0xcc): undefined reference to `wxAppBase::ProcessIdle()'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0xd4): undefined reference to `wxAppConsoleBase::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*)'
obj\Debug\abcApp.o:abcApp.cpp:(.rdata$_ZTV6abcApp[__ZTV6abcApp]+0xd8): undefined reference to `wxAppConsoleBase::OnAssert(wchar_t const*, int, wchar_t const*, wchar_t const*)'
Process terminated with status 1 (0 minute(s), 5 second(s))
50 error(s), 0 warning(s) (0 minute(s), 5 second(s))

I build wxWidgets use
mingw32-make -f makefile.gcc SHARED=0 MONOLITHIC=1 UNICODE=1 BUILD=debug
mingw32-make -f makefile.gcc SHARED=0 MONOLITHIC=1 UNICODE=1 BUILD=release
And it has no error.

Here is my wxWidgets dir:

Code: [Select]
D:\wxWidgets\lib>tree /F /A
卷 SSD_D 的文件夹 PATH 列表
卷序列号为 1AA0-FB8C
D:.
|   abicheck.sh
|   vms.opt
|   vms_gtk.opt
|   vms_gtk2.opt
|   vms_x11_univ.opt
|
\---gcc_lib
    |   libwxexpat.a
    |   libwxexpatd.a
    |   libwxjpeg.a
    |   libwxjpegd.a
    |   libwxmsw31u.a
    |   libwxmsw31ud.a
    |   libwxmsw31ud_gl.a
    |   libwxmsw31u_gl.a
    |   libwxpng.a
    |   libwxpngd.a
    |   libwxregexu.a
    |   libwxregexud.a
    |   libwxscintilla.a
    |   libwxscintillad.a
    |   libwxtiff.a
    |   libwxtiffd.a
    |   libwxzlib.a
    |   libwxzlibd.a
    |
    +---mswu
    |   |   build.cfg
    |   |
    |   \---wx
    |       |   setup.h
    |       |
    |       \---msw
    |               rcdefs.h
    |
    \---mswud
        |   build.cfg
        |
        \---wx
            |   setup.h
            |
            \---msw
                    rcdefs.h

Here is Codeblocks's some setting:

Code: [Select]
[ ] Use wxWidgets DLL
[Y] wxWidgets is build as a monolithic library
[Y] Enable Unicode
« Last Edit: August 20, 2019, 05:55:41 pm by bleakwind »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2454
Re: CodeBlocks with wxWidgets compiler failed.
« Reply #1 on: August 20, 2019, 08:17:18 am »
Are you sure you use the same compiler? To get more information you could add the -v parameter to the linker options and see if it gives you some errors...

Offline bleakwind

  • Single posting newcomer
  • *
  • Posts: 4
Re: CodeBlocks with wxWidgets compiler failed.
« Reply #2 on: August 20, 2019, 08:42:33 am »
Are you sure you use the same compiler? To get more information you could add the -v parameter to the linker options and see if it gives you some errors...

Thanks for your reply.

My os is win7, I use Codeblocks's gcc.

Put this to Path:
D:\CodeBlocks\MinGW\bin


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2454
Re: CodeBlocks with wxWidgets compiler failed.
« Reply #3 on: August 20, 2019, 08:49:58 am »
And you have no other compiler installed? or in the path?

Offline bleakwind

  • Single posting newcomer
  • *
  • Posts: 4
Re: CodeBlocks with wxWidgets compiler failed.
« Reply #4 on: August 20, 2019, 04:06:47 pm »
And you have no other compiler installed? or in the path?

None.

Code: [Select]
C:\Users\Bleakwind>mingw32-g++.exe -v
Using built-in specs.
COLLECT_GCC=mingw32-g++.exe
COLLECT_LTO_WRAPPER=D:/CodeBlocks/MinGW/bin/../libexec/gcc/mingw32/5.1.0/lto-wrapper.exe
Target: mingw32
Configured with: ../../../src/gcc-5.1.0/configure --build=mingw32 --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --disable-symvers --enable-cxx-flags='-fno-function-sections -fno-data-sections -DWINPTHREAD_STATIC' --prefix=/mingw32tdm --with-local-prefix=/mingw32tdm --with-pkgversion=tdm-1 --enable-sjlj-exceptions --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: posix
gcc version 5.1.0 (tdm-1)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6609
    • My Best Post
Re: CodeBlocks with wxWidgets compiler failed.
« Reply #5 on: August 20, 2019, 04:12:53 pm »
After you try every thing else.

Code: [Select]
mingw32-make -f makefile.gcc SHARED=0 MONOLITHIC=1

I would try building using SHARED=0 MONOLITHIC=0 in a new build location.
The combination of SHARED=0 and MONOLITHIC=1 is almost never used; so, it is more likely to be broken in wxWidgets or Code::Blocks.

NOTE: You must build in a new location changing the value of MONOLITHIC in the same location results in a broken wxWidgets build!

Tim S.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2454
Re: CodeBlocks with wxWidgets compiler failed.
« Reply #6 on: August 20, 2019, 04:18:16 pm »
Please add the "-v" to your project build options:
Project->Build options->Compiler settings->Other compiler options
and
Project->Build options->Linker settings-> Other linker options

now make a rebuild by hitting the blue arrows or Build->rebuild

In the build log it should now tell you what libraries it tryst and the reason why they are rejected by the linker.
Pleas post the build log of the rebuild.

Thnak you

Offline bleakwind

  • Single posting newcomer
  • *
  • Posts: 4
Re: CodeBlocks with wxWidgets compiler failed.
« Reply #7 on: August 20, 2019, 05:28:05 pm »
And you have no other compiler installed? or in the path?

Thanks, it is this problem.

On my computer installed perl, perl has gcc.
I remove perl in system path, and rebuild wxWidgets, now everything is fine.

Offline sodev

  • Regular
  • ***
  • Posts: 314
Re: CodeBlocks with wxWidgets compiler failed.
« Reply #8 on: August 20, 2019, 07:51:48 pm »
I would try building using SHARED=0 MONOLITHIC=0 in a new build location.
The combination of SHARED=0 and MONOLITHIC=1 is almost never used; so, it is more likely to be broken in wxWidgets or Code::Blocks.

I can't agree with that, in fact SHARED=0 MONOLITHIC=0 doesn't buy you anything, you are linking statically, unused stuff doesn't get included anyway, its just easier to link with one library in that case. Non-monolithic builds make more sense when using shared libraries, in this case you can skip linking the libraries you don't need so you can reduce the required external dependencies the unused libraries depend on.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6609
    • My Best Post
Re: CodeBlocks with wxWidgets compiler failed.
« Reply #9 on: August 21, 2019, 05:29:17 pm »
I would try building using SHARED=0 MONOLITHIC=0 in a new build location.
The combination of SHARED=0 and MONOLITHIC=1 is almost never used; so, it is more likely to be broken in wxWidgets or Code::Blocks.

I can't agree with that, in fact SHARED=0 MONOLITHIC=0 doesn't buy you anything, you are linking statically, unused stuff doesn't get included anyway, its just easier to link with one library in that case. Non-monolithic builds make more sense when using shared libraries, in this case you can skip linking the libraries you don't need so you can reduce the required external dependencies the unused libraries depend on.

So, how many patches have to had applied to wxWidgets?

I have had over a half a dozen.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline sodev

  • Regular
  • ***
  • Posts: 314
Re: [SOLVED] CodeBlocks with wxWidgets compiler failed.
« Reply #10 on: August 21, 2019, 07:46:11 pm »
Patches to do what? I never applied any patches to wxWidgets, i was always using trunk or now master. I submitted some patches to wxWidgets though to fix various issues, but none were compiling related.

On Windows i am building SHARED=0 and MONOLITHIC=1 since ever, like 10 years or so. From TDM to MinGW to MinGW-w64 and with MSVC 20xx. On Linux i build very rare, but when then with SHARED=1 and MONOLITHIC=0.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6609
    • My Best Post
Re: [SOLVED] CodeBlocks with wxWidgets compiler failed.
« Reply #11 on: August 21, 2019, 08:53:36 pm »
Patches to do what? I never applied any patches to wxWidgets, i was always using trunk or now master. I submitted some patches to wxWidgets though to fix various issues, but none were compiling related.

So, you have submitted patches to wxWidgets.

So, you likely know that MONOLITHIC=1 is less tested; and, it tends to have build errors from time to time. It is not that great of leap to think it might have more run-time issues. Note: I have never noticed a run-time from MONOLITHIC=1; but, I have had multiple build time issues due to the command being too long when using MONOLITHIC=1.

Tim S.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org