cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

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.
Post Reply
Ken_SF
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Jun 11, 2019 9:35 pm

cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

Post by Ken_SF »

Hi,

I am new to C++ but have other Windows programming experience. I was trying to install wxWidgets on Windows 7 32 bit (my computer permits 32 or 64 bit) but keep getting errors when I try to Build a skeleton project created by wxWidgets.

I have searched google extensively, read several articles that seem like they might help, but am simply stumped. I know it can be frustrating helping a newbe, however, I can assure you I have put in many hours of self-research before posting this question to the forum.

I am running Code Blocks 17.12; I just downloaded wxWidgets yesterday using the .7zip package. I eventually figured out I needed to do more than just extract the zip file. I used this link for wxWidgets install instructions: https://wiki.wxwidgets.org/CodeBlocks_Setup_Guide.

Code Blocks seems to work well without wxWidgets; I can compile simple console programs and win32 ansi c programs that make use of createwindowex.

My best memory is that I used the GCC compiler that came with Code Blocks, however, I started down this path long ago with several gaps, so I can't be certain. The Directory for gcc is named TDM-GCC-32 (if that is any help) and the bin sub folder has a bunch of programs that start with mingw32-****.exe. A readme doc warns me that 'this edition of TDM-GCC is an unofficial replacement for the official GCC.'

I am not sure if this information about my compiler is important except that some search references mentioned a common source of some of the errors I have run across occur if you compile wxwidgets with a different compiler than the one used in Code Blocks. My Code Blocks is setup to use GNU GCC Compiler (first option in the combo box list of compiler choices).

BTW: I have also been playing with Visual Studio Express 2017, but have not attempted to use wxWidgets (yet) with Visual Studio. My goal is to become competent with both IDEs.

After installing wxWidgets with mingw32-make.exe as suggested in the wiki link I added some search items to the compiler and added to the linker (as per the same wiki link).

Then I try to create a new wxWidgets project using Code Blocks start page and I get an error: (from Start Here page) --> create new project --> wxWidgets project --> wxWidgets3.1.x --> Next --> Assign title (oktodel), accept default filename and default resulting filename --> next --> accept default author information --> Next --> wxFormBuilder + Frame Based (i have tried a few different combinations, but none have worked) --> next --> accept default wxWidget's location (which is hard coded as c:\...\wxwidget) --> next --> skipping debug config (per advice I saw on line which may have been bad advice, select release config and use default dirs for bin/obj output --> next --> use widgets dll (checked), enable unicode (tried both on and off); I also tried wxWidgets as a monolithic library (per initial instructions from a university website (instructions to students)), but have that feature off now ---> Next

Then I get an error that 'A matching Release configuration cannot be found in the wxWidgets directory you specified. This means the Release Target of your project will not build.'

I can't seem to get by this error. If I ignore the error (I click Yes to are you sure you want to continue) --> I get a list of additional libraries I might want to add to the project --> Finish.

Source code is generated and if I try to build the project (Release mode) lots of cool messages appear in the output box but 3 errors appear.

ld.exe --> cannot find -lwxmsw31_core
ld.exe --> cannot find =lwxbase31

ld returned 1 exit status

No other warnings.

My compiler search directories looks like this

c:\...\wxWidget\lib\gcc_lib\mswu
c:\...\wxWidget\include

My Linker settings screen is blank (nothing new added - I suspect this might be part of my problem but am not sure what to do)

Under Compiler Flags: I added two new items (per the wiki article referenced above). One is for linker stuff and the other for compiler stuff. I don't understand what I added, but diligently followed the instructions.

Never under estimate the power of ignorance: I may have created problems for myself by, at first, using mingw32-make.exe incorrectly. I did run the 'clean' option when following the wiki article, however, I am worried that something became corrupted while following the 'expert' advice of non experts.

I am hoping someone in the forum will know exactly what my problem is and be able to help.

Thanks in advance.

Ken

My build log is below:




-------------- Build: Release in oktodel (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -Wall -O2 -IC:\PBWin10\AnsiCSamples\wxWidget\include -IC:\PBWin10\AnsiCSamples\wxWidget\lib\gcc_dll\msw -IC:\PBWin10\AnsiCSamples\wxWidget\lib\gcc_lib\mswu -IC:\PBWin10\AnsiCSamples\wxWidget\include -c C:\PBWin10\AnsiCSamples\LearnCPP\oktodel\oktodel\GUIFrame.cpp -o obj\Release\GUIFrame.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -Wall -O2 -IC:\PBWin10\AnsiCSamples\wxWidget\include -IC:\PBWin10\AnsiCSamples\wxWidget\lib\gcc_dll\msw -IC:\PBWin10\AnsiCSamples\wxWidget\lib\gcc_lib\mswu -IC:\PBWin10\AnsiCSamples\wxWidget\include -c C:\PBWin10\AnsiCSamples\LearnCPP\oktodel\oktodel\oktodelApp.cpp -o obj\Release\oktodelApp.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -Wall -O2 -IC:\PBWin10\AnsiCSamples\wxWidget\include -IC:\PBWin10\AnsiCSamples\wxWidget\lib\gcc_dll\msw -IC:\PBWin10\AnsiCSamples\wxWidget\lib\gcc_lib\mswu -IC:\PBWin10\AnsiCSamples\wxWidget\include -c C:\PBWin10\AnsiCSamples\LearnCPP\oktodel\oktodel\oktodelMain.cpp -o obj\Release\oktodelMain.o
windres.exe -IC:\PBWin10\AnsiCSamples\wxWidget\include -IC:\PBWin10\AnsiCSamples\wxWidget\lib\gcc_dll\msw -J rc -O coff -i C:\PBWin10\ANSICS~1\LearnCPP\oktodel\oktodel\resource.rc -o obj\Release\resource.res
mingw32-g++.exe -LC:\PBWin10\AnsiCSamples\wxWidget\lib\gcc_dll -o bin\Release\oktodel.exe obj\Release\GUIFrame.o obj\Release\oktodelApp.o obj\Release\oktodelMain.o obj\Release\resource.res -s -mthreads -lwxmsw31_core -lwxbase31 -lwxpng -lwxzlib -mwindows
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: cannot find -lwxmsw31_core
C:/TDM-GCC-32/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: cannot find -lwxbase31
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 4 second(s))
3 error(s), 0 warning(s) (0 minute(s), 4 second(s))
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

Post by doublemax »

It sounds like to didn't compile wxWidgets itself. That's Step 3 on the Setup Guide you posted. It's also important that you select the correct options in your CB project based on the wxWidgets building options you made.

This post might help with the latter part:
viewtopic.php?p=169501&sid=8b310aedd398 ... 93#p169501
This is still based on wx 3.0.x, but when using 3.1.x the only difference is with the version numbers in the files. (30 vs 31).
Use the source, Luke!
Ken_SF
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Jun 11, 2019 9:35 pm

Re: cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

Post by Ken_SF »

Thank you!

Your reply and the post you referenced make perfect sense.

I will take those steps and post my results.

Best Regards

Ken
Ken_SF
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Jun 11, 2019 9:35 pm

Re: cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

Post by Ken_SF »

Unfortunately, I believe the ming32-make.exe command failed before it was finished.

As per the wiki instructions at: https://wiki.wxwidgets.org/CodeBlocks_Setup_Guide

I decided to start over because the wiki article warned "If you mess up and want to clean, you have to pass the same parameters to make clean." I am certain I executed many wrong combinations of ming32-make.exe in my prior attempts.

I renamed the old wxwidget directory to wxwidget_old and downloaded the .7zip package from the xwidgets website. I extracted the files into a directory named wxwidget3127.

I also installed a different version of gcc from codeblock's website. I removed the old directory from my window's path. The old directory was named TDM-GCC-32 and is now named TDM-GCC-32_old. The new directory is named TDM-GCC-64.

After installing the 32/64 bit version of GCC and reinstalling wxwidget into the wxwidget3127 folder, I verified the config.gcc file matched the suggested options in the wiki article. I did have to make some changes to the .gcc file to make the suggested wiki arguments match the config file.

I entered mingw32-make.exe -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=0 from the windows cmd prompt.

I saw compile messages scroll down the screen and then an error message at the end that said:

makefile.gcc:6978 recipe for target 'gcc_mswdll\monodll_artsmw.o' failed
ming32-make.exe: *** [gcc_mswdll\monodll_artmsw.o] Error 1

The compile process stopped at this point. I don't believe the process took as long as it did when I initially tried this step.

Suggestions?

Thanks in advance for your help.


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

Re: cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

Post by doublemax »

The UNICODE=0 part in the guide is definitely outdated.

Try these (you need both):

Code: Select all

mingw32-make.exe -f makefile.gcc SHARED=0 BUILD=debug
mingw32-make.exe -f makefile.gcc SHARED=0 BUILD=release
If this works, you need to change the CB setup accordingly.
On the 8th page,
1) since you built with "SHARED=0", make sure use wxWidgets DLL is unselected,
2) since you built with "MONOLITHIC=0", don't select that
3) With the wxWidgets 3.0.x, you should always select Enable Unicode
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

Post by ONEEYEMAN »

Hi,
You don't have to specify "MONOLITIC=0". This is the default.
You also shouldn't change any of the standatrd distribution build-related files. So whatever you did change - please undo that.

After that just follow doublemax's suggestion.
Let us know if you get into any issues.

Thank you.
Ken_SF
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Jun 11, 2019 9:35 pm

Re: cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

Post by Ken_SF »

This was helpful advice, thank you. I definitely made progress.

The mingw32-make.exe compilations seemed to work correctly and took about the same amount of time as my initial attempt; I didn't notice any error messages at the end of release or debug processing.

Now, I need to double check my search directories (settings --> compiler --> search directories) and compiler flags (settings -- compiler --> compiler flags) and I will attempt a very simple code blocks project.

Thanks again. I will post success or failure messages until my first project has compiled.

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

Re: cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

Post by ONEEYEMAN »

Hi,
In order to set everything up correctly:

Try to go to the samples/minimal directory and issue exactly the same command you did when building the library.
Look what was produced as a build command and do exactly the same.

Thank you.
Ken_SF
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Jun 11, 2019 9:35 pm

Re: cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

Post by Ken_SF »

I executed this command from the cmd prompt in the C:\wxWidgets-3.1.2\samples\minimal directory.

mingw32-make.exe -f makefile.gcc SHARED=0 BUILD=release

I believe this worked correctly. After the command processed there is a new (I think) gcc_mswu directory and inside that directory is a new exe named minimal.exe. That program launches a simple windows application.

I take this to mean that wxwidgets is setup correctly and any problems I have from here on out are either code block's problems or setup problems within code blocks.

To that end I setup a new code blocks wxwidgets project and tried to compile and did not get stopped by the prior errors I had reported but did get 50 new errors. I am not exaggerating when I say I am new to C++; I am experienced in programming other languages but C++ is a different animal in many respects.

Below is the build log from my first code blocks project attempt since minimal.exe was created correctly with mingw32-make.exe. I was careful to check unicode = yes, dll = no, monolithic = no.

My search directories (settings --> compiler --> search directories) looks like this:
C:\wxWidgets-3.1.2\lib\gcc_lib_nodll_nomono
C:\wxWidgets-3.1.2\include

My compiler flag entries look like (settings --> compiler --> compiler flags)
misc description I made up [wx-config --cxxflags]
misc description I made up [wx-config --libs]

Build log is below.

Any idea what I haven't done that needs to be done?

Thanks in advance.

Ken

-------------- Build: Release in oktodel (compiler: GNU GCC Compiler)---------------

x86_64-w64-mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_lib\mswu -IC:\wxWidgets-3.1.2\lib\gcc_lib_nodll_nomono -IC:\wxWidgets-3.1.2\include -c C:\PBWin10\AnsiCSamples\LearnCPP\oktodel\GUIFrame.cpp -o obj\Release\GUIFrame.o
x86_64-w64-mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_lib\mswu -IC:\wxWidgets-3.1.2\lib\gcc_lib_nodll_nomono -IC:\wxWidgets-3.1.2\include -c C:\PBWin10\AnsiCSamples\LearnCPP\oktodel\oktodelApp.cpp -o obj\Release\oktodelApp.o
x86_64-w64-mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_lib\mswu -IC:\wxWidgets-3.1.2\lib\gcc_lib_nodll_nomono -IC:\wxWidgets-3.1.2\include -c C:\PBWin10\AnsiCSamples\LearnCPP\oktodel\oktodelMain.cpp -o obj\Release\oktodelMain.o
windres.exe -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_lib\mswu -J rc -O coff -i C:\PBWin10\ANSICS~1\LearnCPP\oktodel\resource.rc -o obj\Release\resource.res
x86_64-w64-mingw32-g++.exe -LC:\wxWidgets-3.1.2\lib\gcc_lib -o bin\Release\oktodel.exe obj\Release\GUIFrame.o obj\Release\oktodelApp.o obj\Release\oktodelMain.o obj\Release\resource.res -s -mthreads -lwxmsw31u_core -lwxbase31u -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -lshlwapi -lversion -mwindows
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0xdb8c): undefined reference to `__imp_OpenThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0xdbad): undefined reference to `__imp_GetThemeColor'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0xdc22): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0xe250): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0xe2cb): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0x10564): undefined reference to `__imp_OpenThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0x105f2): undefined reference to `__imp_GetThemeBackgroundContentRect'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0x10647): undefined reference to `__imp_IsThemeBackgroundPartiallyTransparent'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0x10662): undefined reference to `__imp_DrawThemeParentBackground'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0x10699): undefined reference to `__imp_DrawThemeBackground'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0x106c6): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0x113ce): undefined reference to `__imp_OpenThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0x11446): undefined reference to `__imp_GetThemeBackgroundContentRect'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0x11d3c): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_window.o):window.cpp:(.text+0x11e39): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x446): undefined reference to `__imp_OpenThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x461): undefined reference to `__imp_GetThemeSysColor'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x49e): undefined reference to `__imp_GetThemeSysColor'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x4e1): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x55d): undefined reference to `__imp_GetThemeSysColor'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x5e4): undefined reference to `__imp_GetThemeSysColor'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x652): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x2047): undefined reference to `__imp_OpenThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x2075): undefined reference to `__imp_GetThemeMargins'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x214e): undefined reference to `__imp_GetThemePartSize'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x21c4): undefined reference to `__imp_GetThemeInt'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x21ec): undefined reference to `__imp_GetThemeSysFont'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x2325): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x236f): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x2e1d): undefined reference to `__imp_OpenThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x2e70): undefined reference to `__imp_DrawThemeBackground'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x2f03): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x3157): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x3eab): undefined reference to `__imp_OpenThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x3ebf): undefined reference to `__imp_IsThemeBackgroundPartiallyTransparent'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x3ece): undefined reference to `__imp_DrawThemeBackground'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x3f3d): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x4288): undefined reference to `__imp_DrawThemeBackground'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x42f4): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_menuitem.o):menuitem.cpp:(.text+0x450e): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_msw_statbox.o):statbox.cpp:(.text+0x26f0): undefined reference to `__imp_OpenThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_msw_statbox.o):statbox.cpp:(.text+0x271d): undefined reference to `__imp_GetThemeFont'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_msw_statbox.o):statbox.cpp:(.text+0x2739): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_msw_statbox.o):statbox.cpp:(.text+0x27af): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_statusbar.o):statusbar.cpp:(.text+0x1b9b): undefined reference to `__imp_OpenThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_statusbar.o):statusbar.cpp:(.text+0x1bd9): undefined reference to `__imp_GetThemeBackgroundContentRect'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_statusbar.o):statusbar.cpp:(.text+0x1c18): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_statusbar.o):statusbar.cpp:(.text+0x1e48): undefined reference to `__imp_CloseThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_renderer.o):renderer.cpp:(.text+0x4b2): undefined reference to `__imp_OpenThemeData'
C:\wxWidgets-3.1.2\lib\gcc_lib/libwxmsw31u_core.a(corelib_renderer.o):renderer.cpp:(.text+0x4cb): undefined reference to `__imp_IsThemePartDefined'
Process terminated with status 1 (0 minute(s), 7 second(s))
50 error(s), 0 warning(s) (0 minute(s), 7 second(s))
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

Post by doublemax »

These are all linker errors (not compiler errors), which means you have gotten very far already ;)

This should be the final step:
viewtopic.php?p=183340#p183340
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

Post by ONEEYEMAN »

Hi,
Ken_SF wrote: Thu Jun 13, 2019 5:36 pm I executed this command from the cmd prompt in the C:\wxWidgets-3.1.2\samples\minimal directory.

mingw32-make.exe -f makefile.gcc SHARED=0 BUILD=release

I believe this worked correctly. After the command processed there is a new (I think) gcc_mswu directory and inside that directory is a new exe named minimal.exe. That program launches a simple windows application.

I take this to mean that wxwidgets is setup correctly and any problems I have from here on out are either code block's problems or setup problems within code blocks.

To that end I setup a new code blocks wxwidgets project and tried to compile and did not get stopped by the prior errors I had reported but did get 50 new errors. I am not exaggerating when I say I am new to C++; I am experienced in programming other languages but C++ is a different animal in many respects.

Below is the build log from my first code blocks project attempt since minimal.exe was created correctly with mingw32-make.exe. I was careful to check unicode = yes, dll = no, monolithic = no.

My search directories (settings --> compiler --> search directories) looks like this:
C:\wxWidgets-3.1.2\lib\gcc_lib_nodll_nomono
C:\wxWidgets-3.1.2\include

My compiler flag entries look like (settings --> compiler --> compiler flags)
misc description I made up [wx-config --cxxflags]
misc description I made up [wx-config --libs]

Build log is below.

Any idea what I haven't done that needs to be done?

Thanks in advance.

Ken

-------------- Build: Release in oktodel (compiler: GNU GCC Compiler)---------------

x86_64-w64-mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_lib\mswu -IC:\wxWidgets-3.1.2\lib\gcc_lib_nodll_nomono -IC:\wxWidgets-3.1.2\include -c C:\PBWin10\AnsiCSamples\LearnCPP\oktodel\GUIFrame.cpp -o obj\Release\GUIFrame.o
x86_64-w64-mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_lib\mswu -IC:\wxWidgets-3.1.2\lib\gcc_lib_nodll_nomono -IC:\wxWidgets-3.1.2\include -c C:\PBWin10\AnsiCSamples\LearnCPP\oktodel\oktodelApp.cpp -o obj\Release\oktodelApp.o
x86_64-w64-mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_lib\mswu -IC:\wxWidgets-3.1.2\lib\gcc_lib_nodll_nomono -IC:\wxWidgets-3.1.2\include -c C:\PBWin10\AnsiCSamples\LearnCPP\oktodel\oktodelMain.cpp -o obj\Release\oktodelMain.o
windres.exe -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_lib\mswu -J rc -O coff -i C:\PBWin10\ANSICS~1\LearnCPP\oktodel\resource.rc -o obj\Release\resource.res
x86_64-w64-mingw32-g++.exe -LC:\wxWidgets-3.1.2\lib\gcc_lib -o bin\Release\oktodel.exe obj\Release\GUIFrame.o obj\Release\oktodelApp.o obj\Release\oktodelMain.o obj\Release\resource.res -s -mthreads -lwxmsw31u_core -lwxbase31u -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -lshlwapi -lversion -mwindows
Per http://forums.codeblocks.org/index.php?topic=22455.0, you should add "-luxtheme" to the linker command.
Like I said - when you were building minimal.exe, you shuold look at the command generated and replicate that inside the C::B project.

I'm sure you would've found the uxtheme inside the minimal build log.

Thank you.
Ken_SF
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Jun 11, 2019 9:35 pm

Re: cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

Post by Ken_SF »

Thank you.

Unfortunately, there was no log that I could see after using mingw32-make.exe on the minimal project using the command window. I saw a bunch of text in the cmd window, but it was unintelligible to me as a newbe. I tried to cut and paste that text from the cmd window without success and I neglected to take a screen shot.

I'm also not experienced to know how to transpose the commands I entered manually to compile minimal.exe (or the log files) into CB; that is beyond my pay grade at this point.

I am guessing that the uxtheme reference needs to be added to settings --> compiler --> link libraries --> add --> add the appropriate files.

I did not understand the reference in= http://forums.codeblocks.org/index.php?topic=22455.0 - that said: "...so you should add it to the linker settings near shlwapi or wsock32." I don't get the idea that linker settings are 'near' some other files or directories.

I'll play around with this, look for documentation, and see if I can get this to work.

Ken
Ken_SF
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Jun 11, 2019 9:35 pm

Re: cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

Post by Ken_SF »

Ok, I got this to work.

Many thanks to those who helped me and especially for the patience you showed me, required because of my inexperience.

I found this link very helpful: viewtopic.php?t=44529

I added the two .a files specified in the link above to the settings --> compiler --> linker settings tab. I clicked 'add', found the files I needed in the COMPILER's (not wxWidget's) lib directory and rebuilt my project.

The two files I added were:
libuxtheme.a
liboleacc.a

I didn't completely understand how to get from the build message (in code blocks which, in this case, references a function that can't be found in a wxwigets program) to the name of the gcc (compiler's) library file that is needed. I guessed that I needed to search for the function name reported in code block's build log in the compiler's directory.

I did a search to test my theory (after I had already fixed my problem using the instructions in the above link) and it seemed to work.

I searched for 'GetThemeColor' in my compiler's directory C:\TDM-GCC-64\ (searching the entire directory and searching for matching contents) and identified that the libuxtheme.a file had the reference I was looking for. I found a result in two directories. Next time I will likely search only for files with the .a extension and restrict my search to a single lib directory underneath the compiler's main directory to save time.

My build log error messages are gone now, but one from the link above (someone else's project) reads like this:

C:\wxWidgets-3.1.1\lib\gcc_lib\libwxmsw31u.a(monolib_window.o):window.cpp|| undefined reference to `GetThemeColor@20'|

I just guessed 'getthemecolor' is the function name associated with that error line and that is how I derived a method to search for the compiler function that needed to be included.

I hope this post and the earlier posts help someone else going forward.

Thanks again for the help.

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

Re: cannot find -lwxmsw31u_core and -lwxbase31u build errors code blocks with

Post by doublemax »

If a missing reference doesn't start with "wx" and you're working under Windows, there's a good chance it's a Windows function. So it's always worth a try to Google "msdn GetThemeColor". In this particular case, the first hit would have been:
https://docs.microsoft.com/en-us/window ... themecolor

And near the bottom of the page you would have found the library that contains that method.
Use the source, Luke!
Post Reply