library problem

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
navaleng
In need of some credit
In need of some credit
Posts: 8
Joined: Thu Apr 05, 2018 5:14 pm

library problem

Postby navaleng » Thu Apr 05, 2018 5:20 pm

I haven't used Codeblocks in a long time so I've reinstalled everything. The compiler seems to work fine, but the linker is complaining:

Code: Select all

Release\lib\uc_uw.o:uc_uw.cpp:(.text$_ZN23wxCriticalSectionLockerC1ER17wxCriticalSection[__ZN23wxCriticalSectionLockerC1ER17wxCriticalSection]+0x19)||undefined reference to `wxCriticalSection::Enter()'|


I've included every library I can find, but no joy. Any ideas? It doesn't matter what .o file I use they all have the same error.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2423
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: library problem

Postby ONEEYEMAN » Thu Apr 05, 2018 5:57 pm

Hi,
What exact command is executing during the linking stage?

Thank you.

User avatar
doublemax
Moderator
Moderator
Posts: 12206
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: library problem

Postby doublemax » Thu Apr 05, 2018 6:05 pm

wxCriticalSection is part of the "base" library and therefore should always be available. Are you sure you're not linking to any old libraries lying around? Try a clean rebuild of everything.
Use the source, Luke!

navaleng
In need of some credit
In need of some credit
Posts: 8
Joined: Thu Apr 05, 2018 5:14 pm

Re: library problem

Postby navaleng » Fri Apr 06, 2018 5:06 pm

I presume that this is the base: E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxbase31u.lib

Funny thing is it all worked under VS2017. But I was almost out of memory on the C drive which is an SSD. M$ insists on putting VS2017 on the C drive along with just about everything else and I simply ran out of room and deleted VS2017 before I realized that it had to be on C. Now, because of updates there is no more room. So I've moved to CodeBlocks which is on a real hard drive. So here is the command and it's output....

Code: Select all

-------------- Build: Release x64 in UC (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe  -o Release\UC.exe Release\lib\uc_uw.o Release\Underway_FSX\test\UW_Public.o Release\Underway_for_ships\cargo.o Release\Underway_for_ships\classification.o Release\Underway_for_ships\closing.o Release\Underway_for_ships\control.o Release\Underway_for_ships\damage.o Release\Underway_for_ships\deck.o Release\Underway_for_ships\draw.o Release\Underway_for_ships\ecm.o Release\Underway_for_ships\eltr.o Release\Underway_for_ships\esm.o Release\Underway_for_ships\esm_report.o Release\Underway_for_ships\gun.o Release\Underway_for_ships\history.o Release\Underway_for_ships\iff.o Release\Underway_for_ships\io.o Release\Underway_for_ships\messages.o Release\Underway_for_ships\misc.o Release\Underway_for_ships\missile.o Release\Underway_for_ships\navigation.o Release\Underway_for_ships\opening.o Release\Underway_for_ships\pax.o Release\Underway_for_ships\platform.o Release\Underway_for_ships\plot_readout.o Release\Underway_for_ships\radar.o Release\Underway_for_ships\rearm.o Release\Underway_for_ships\sonar.o Release\Underway_for_ships\sonobuoy.o Release\Underway_for_ships\tacan.o Release\Underway_for_ships\tdd.o Release\Underway_for_ships\time_readout.o Release\Underway_for_ships\torpedo.o Release\Underway_for_ships\widgets.o  Release\Underway_for_ships\captain.rc.res -static-libgcc  G:\CodeBlocks\MinGW\lib\libuxtheme.a G:\audiere-1.9.4-win32_win64_msvc2005\audiere-1.9.4-win32_win64_msvc2005\lib64\audiere.lib G:\CodeBlocks\MinGW\lib\libwinmm.a G:\CodeBlocks\MinGW\lib\libcomctl32.a G:\CodeBlocks\MinGW\lib\libkernel32.a G:\CodeBlocks\MinGW\lib\libuser32.a G:\CodeBlocks\MinGW\lib\libgdi32.a G:\CodeBlocks\MinGW\lib\libwinspool.a G:\CodeBlocks\MinGW\lib\libcomdlg32.a G:\CodeBlocks\MinGW\lib\libadvapi32.a G:\CodeBlocks\MinGW\lib\libshell32.a G:\CodeBlocks\MinGW\lib\libole32.a G:\CodeBlocks\MinGW\lib\liboleaut32.a G:\CodeBlocks\MinGW\lib\libuuid.a G:\CodeBlocks\MinGW\lib\libodbc32.a G:\CodeBlocks\MinGW\lib\libodbccp32.a E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxbase31u.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxbase31u_net.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxbase31u_xml.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxregexu.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxjpeg.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxpng.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxexpat.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxmsw31u_html.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxscintilla.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxtiff.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxzlib.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxmsw31u_adv.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxmsw31u_core.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxmsw31u_gl.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxmsw31u_propgrid.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxmsw31u_ribbon.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxmsw31u_stc.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxmsw31u_qa.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxmsw31u_xrc.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxmsw31u_aui.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxmsw31u_richtext.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxmsw31u_webview.lib E:\wxWidgets-3.1.1\lib\vc_x64_lib\wxmsw31u_media.lib "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64\ComCtl32.lib" "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64\wsock32.lib" "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64\winmm.lib" "G:\Program Files\Lockheed Martin\Prepar3D v4 SDK 4.0.23.21468\lib\SimConnect\SimConnect.lib" G:\CodeBlocks\MinGW\lib\libuxtheme.a G:\audiere-1.9.4-win32_win64_msvc2005\audiere-1.9.4-win32_win64_msvc2005\lib64\audiere.lib -mwindows
Release\lib\uc_uw.o:uc_uw.cpp:(.text$_ZN23wxCriticalSectionLockerC1ER17wxCriticalSection[__ZN23wxCriticalSectionLockerC1ER17wxCriticalSection]+0x19): undefined reference to `wxCriticalSection::Enter()'
Release\lib\uc_uw.o:uc_uw.cpp:(.text$_ZN23wxCriticalSectionLockerD1Ev[__ZN23wxCriticalSectionLockerD1Ev]+0x11): undefined reference to `wxCriticalSection::Leave()'
G:/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: Release\lib\uc_uw.o: bad reloc address 0x11 in section `.text$_ZN23wxCriticalSectionLockerD1Ev[__ZN23wxCriticalSectionLockerD1Ev]'
G:/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/5.1.0/../../../../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), 1 second(s))
3 error(s), 0 warning(s) (0 minute(s), 1 second(s))
 

User avatar
doublemax
Moderator
Moderator
Posts: 12206
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: library problem

Postby doublemax » Fri Apr 06, 2018 6:31 pm

First of all i would suggest to try and build the "minimal" sample first before you try to build your own project.

More important, all these library paths contain "vc_x64_lib". That's the path for the Visual C libraries. But as you're using MinGW you also have to rebuild the wxWidgets libraries and use those. The path will be different, too.
Use the source, Luke!

navaleng
In need of some credit
In need of some credit
Posts: 8
Joined: Thu Apr 05, 2018 5:14 pm

Re: library problem

Postby navaleng » Fri Apr 06, 2018 7:33 pm

Ah! I guess that makes sense. Will do! Thank you as I wasn't sure if I had to do that.

navaleng
In need of some credit
In need of some credit
Posts: 8
Joined: Thu Apr 05, 2018 5:14 pm

Re: library problem

Postby navaleng » Mon Apr 23, 2018 8:25 pm

Ok, so I have spent the intervening days dropping back to wxWidgets 3.0.4. I got it compiled successfully. All my code compiled correctly - it's amazing how many "bugs" a new compiler can find. So I am now in the process of linking to the wx libraries. I had to download and install a jpeg library - that cleared up all the jpeg related problems. Now however I am getting a bunch of "undefined reference to wx_png_get_io_ptr" and similar wx_png library errors. I've tried moving the libwxpng.a file around in the linker settings but that has not helped. I have not found any documentation on these errors. I also downloaded a libpng16.a - but methinks this is a wx problem as that's the error message. For the graphics libraries I have (in link order)

Code: Select all

libjpeg.a
libwxjpeg.a
libwxzlib.a
libwxpng.a
libwxtiff.a


There are tiff errors too but that's for solving later on. Any help will be greatly appreciated.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2423
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: library problem

Postby ONEEYEMAN » Mon Apr 23, 2018 8:36 pm

Hi,
Try to build either minimal or drawing sample. Just go to c:\wxWidgets-3.0.4\buildWin\samples\{minimal|drawing} and issue exactly the same command you used to build wxWidgets library.

See what command will be used and modify you build script accordingly.

Thank you.

navaleng
In need of some credit
In need of some credit
Posts: 8
Joined: Thu Apr 05, 2018 5:14 pm

Re: library problem

Postby navaleng » Thu Apr 26, 2018 7:54 pm

Well, I must have screwed something up so I am rebuilding wxWidgets 3.0.4 using MingW. I have had to cast numerous strings to LPCSTRs. While I might accept that this is a minor problem, I have now encountered a superbly bit of poor programming and I cannot figure out what the following line of code means - that is just what is text?

This line is in Checkbox.cpp line 463 and similarly 483. text is not defined anywhere I can find - and of course, the compiler complains and errors out.

Code: Select all

       if ( !::DrawText(hdc, text.t_stlabel.t_str(), label.length(), &rectLabel,  fmt | DT_CALCRECT) )


I have also looked for t_stlabel (as in text.t_stlabel) and cannot find it in source or headers. Ack! And help please.

stahta01
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 218
Joined: Fri Nov 03, 2006 2:00 pm

Re: library problem

Postby stahta01 » Fri Apr 27, 2018 12:27 am

navaleng wrote:Well, I must have screwed something up so I am rebuilding wxWidgets 3.0.4 using MingW. I have had to cast numerous strings to LPCSTRs. While I might accept that this is a minor problem, I have now encountered a superbly bit of poor programming and I cannot figure out what the following line of code means - that is just what is text?

This line is in Checkbox.cpp line 463 and similarly 483. text is not defined anywhere I can find - and of course, the compiler complains and errors out.

Code: Select all

       if ( !::DrawText(hdc, text.t_stlabel.t_str(), label.length(), &rectLabel,  fmt | DT_CALCRECT) )


I have also looked for t_stlabel (as in text.t_stlabel) and cannot find it in source or headers. Ack! And help please.


Git says that file does not contain what you posted and it was lasted edited in 2013.

I suggest you redownload the wxWidgets 3.0.4 and see if the code is the same.

Tim S.

navaleng
In need of some credit
In need of some credit
Posts: 8
Joined: Thu Apr 05, 2018 5:14 pm

Re: library problem

Postby navaleng » Fri Apr 27, 2018 7:24 pm

Thank you Tim S. I have no idea what went wrong with the original download. They look to be identical. But I was sure chasing down a very bad rabbit hole. Re-downloaded and it all compiled correctly. =D>

Now let's hope I can actually get my code to link properly. [-o<

navaleng
In need of some credit
In need of some credit
Posts: 8
Joined: Thu Apr 05, 2018 5:14 pm

Re: library problem

Postby navaleng » Fri May 11, 2018 7:31 pm

After much gnashing of teeth and trial and error I've gotten everything to compile. But the linker is complaining:

Code: Select all

||=== Build: Release x64 in UC (compiler: GNU GCC Compiler) ===|
G:\wxWidgets-3.0.4\lib\gcc_lib\libwxmsw30u_core.a(corelib_appcmn.o):appcmn.cpp|| undefined reference to `__imp___acrt_iob_func'


This is apparently the only error left to solve. I have search for days trying to find out what this "acrt" is - it might be an M$ library, but I can't find which one. Doing a bunch of nm searches finds nothing in any of the TDM libraries (unless I'm doing it wrong).

Code: Select all

$ nm -A -C *.a | fgrep __imp__acrt_iob_func


this is the <linker> section of CodeBlocks:

Code: Select all

<Linker>
               <Add option="-static" />
               <Add option="-m64" />
               <Add option="-mwindows --verbose" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxmsw30u_html.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxmsw30u_adv.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxmsw30u_core.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxbase30u.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxbase30u_net.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxbase30u_xml.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxexpat.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxjpeg.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxmsw30u_aui.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxmsw30u_gl.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxmsw30u_media.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxmsw30u_propgrid.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxmsw30u_ribbon.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxmsw30u_richtext.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxmsw30u_stc.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxmsw30u_webview.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxmsw30u_xrc.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxpng.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxregexu.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxscintilla.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxtiff.a" />
               <Add library="G:/wxWidgets-3.0.4/lib/gcc_lib/libwxzlib.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/libkernel32.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/libuser32.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/libgdi32.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/libwinspool.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/libcomdlg32.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/libwinmm.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/libshell32.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/libcomctl32.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/libole32.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/liboleaut32.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/libuuid.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/libadvapi32.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/libwsock32.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/libwininet.a" />
               <Add library="G:/TDM-GCC-64/x86_64-w64-mingw32/lib/libws2_32.a" />
               <Add directory="G:/wxWidgets-3.0.4/lib/gcc_lib" />
               <Add directory="G:/wxWidgets-3.0.4/lib/gcc_lib/mswu" />

</Linker>


Any idea what library I'm missing?

User avatar
doublemax
Moderator
Moderator
Posts: 12206
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: library problem

Postby doublemax » Fri May 11, 2018 7:50 pm

Googling the exact error message "undefined reference to `__imp___acrt_iob_func'" tells you that this is only present in very recent versions of MinGW, i guess you're mixing in libraries that were built with a newer compiler somewhere.

Rebuild everything from scratch with the same compiler.
Use the source, Luke!

stahta01
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 218
Joined: Fri Nov 03, 2006 2:00 pm

Re: library problem

Postby stahta01 » Sat May 12, 2018 12:12 am

Code: Select all

<Add option="-mwindows --verbose" />


Not related to your error; but, it is best to do the linker options one per line in the C::B Gui.

Tim S.

navaleng
In need of some credit
In need of some credit
Posts: 8
Joined: Thu Apr 05, 2018 5:14 pm

Re: library problem

Postby navaleng » Mon May 14, 2018 6:32 pm

Thanks for the info. I didn't use Google, but ixquick to do my searches. Not sure why just one library should be such a problem, but it is what it is. Still, wxWidgets was built using the TDM gcc as is my own code with the same options. I guess I have to surrender, at least until M$ decides you can install Visual Studio somewhere besides the C directory. I've used wxWidgets/VS for over a decade with great success. :(

Best wishes


Return to “Compiler / Linking / IDE Related”

Who is online

Users browsing this forum: No registered users and 4 guests