You NEED to decide what directions you are going to follow; then, you need to follow them.
You should NOT mix two different ways of using wxWidgets with CB and expect them to work!
Either follow the standard windows way of using the Global Variable WX or WX30 or do the wx-config.exe way.
wx-config way includes this step in the codeblocks setup.
add environment variables as:
WXCFG = C:\wxWidgets-3.0.0
WXWIN = gcc_dll\mswud
YOU MUST DECIDE.
You must tell us which way you are doing!
You need to tell us if you are using the CB wxWidgets wizard!
(If the error happens during the wizard you need to tell us.)
You need to post the full re-build log if you want help doing either way. (once finished with running wizard.)
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)
Tim S.
Hi:
I never touched the wx-config stuffs neither I didn't know that yet, but you let me know that name now ;-) I was just followed the wxWidgets' guide, add the Global variable purely, and start my new prject through CB's vizard, thus I think I'm in the standard windows way. Tell me if I'm wrong!
By the way, what differences are their between them?
And hope that you staffs can make a wxWidgets setup guide with step by step screenshot pictures either in Linux, Mac and windows, this will really help newbies or noobs like me to save much times, even can help you to prevent repeat answering much similar noob questions ;-)
Anyway, In my case, first of all, I just created the test project by click the wxWidget icon in the wizard, and follow the steps:
- wxWidgets version -> wxWidgets 3.0.x
- Preferred GUI Builder -> None; Application Type -> Frame Base
(What differs between Dialog Based and Frame Based? Sorry 4 this, I'm a noob)
- wxWidgetsl location -> $(#wx) <-- which causes an error, so i gave it the exact path
C:\wxWidgets-3.0.0
- Create "Debug" configuration
- wxWidgets Library Setting -> checked all 3 choices on
Miscellaneous Settings -> enabled Advanced Options, and it gave me an Warning popup
says: 'A matching Debug configuration cannot be found in the wxWidgets directory you specified...'
After done these, run build, then it says no wx/setup.h, then after googling found a tips which told me to add next line in 'Settings -> Global compiler settings -> Search directories -> Compiler'
C:\wxWidgets-3.0.0\lib\gcc_dll\mswu
and as mine doesn't have 'mswu' directory, so I changed to 'mswud', then run build, this time it says the above error: 'ld.exe cannot find -lwxmsw30u'
For to catch my mistakes, I've done the same job in virtualbox run win xp with putting the gcc stuffs in directory 'c:\etc\...'
Now is the log:
-------------- Build: Debug in aaa (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -g -IC:\etc\wxWidgets-3.0.0\include -IC:\etc\wxWidgets-3.0.0\lib\gcc_dll\mswu -IC:\etc\wxWidgets-3.0.0\lib\gcc_dll\mswud -c C:\local\codeblocks\aaa\aaaApp.cpp -o obj\Debug\aaaApp.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -g -IC:\etc\wxWidgets-3.0.0\include -IC:\etc\wxWidgets-3.0.0\lib\gcc_dll\mswu -IC:\etc\wxWidgets-3.0.0\lib\gcc_dll\mswud -c C:\local\codeblocks\aaa\aaaMain.cpp -o obj\Debug\aaaMain.o
windres.exe -IC:\etc\wxWidgets-3.0.0\include -IC:\etc\wxWidgets-3.0.0\lib\gcc_dll\mswu -J rc -O coff -i C:\local\CODEBL~1\aaa\resource.rc -o obj\Debug\resource.res
mingw32-g++.exe -LC:\etc\wxWidgets-3.0.0\lib\gcc_dll -o bin\Debug\aaa.exe obj\Debug\aaaApp.o obj\Debug\aaaMain.o obj\Debug\resource.res -mthreads -lwxmsw30u -mwindows
c:/etc/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lwxmsw30u
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 10 second(s))
1 error(s), 0 warning(s) (0 minute(s), 10 second(s))
Hope that I put enough infos to help myself!
Thank you stahta01 for reply, you are a good man!
You have both
-IC:\etc\wxWidgets-3.0.0\lib\gcc_dll\mswu
-IC:\etc\wxWidgets-3.0.0\lib\gcc_dll\mswud
Get rid of the one that does NOT exist.
You say you only built debug; is there a logical reason you are doing that instead of both?
Edit: You need to define "__WXDEBUG__" when using the wxWidgets debug library.
Tim S.
My build log on doing wxWidgets 3.0 Debug build Multilib (removed PCH precompile)
(Multilib is the opposite choose of Monolithic build)
Where mine says "gcc48_dll" yours should say "gcc_dll"
Where mine says "-lwxmsw30ud_core -lwxbase30ud" yours should say "-lwxmsw30ud".
Where mine says "testwx48" yours should say "aaa".
My wxWidgets base folder: "C:\wxMSW-3.0\wxWidgets-3.0.0"
Note: You build need not have "-include wx_pch.h" in it.
Note: This option is NOT needed "-Wmissing-include-dirs"
Note: Yours might not have "--use-temp-file" in it; I added that to test something long ago.
Change "wxmsw30u" to "wxmsw30ud" in "Linker Settings" under "Link Libraries"
Note: These NOT needed "-Wfatal-errors -Wno-unused-local-typedefs -Wno-attributes"
Tim S.
windres.exe --use-temp-file -IC:\wxMSW-3.0\wxWidgets-3.0.0\include -IC:\wxMSW-3.0\wxWidgets-3.0.0\lib\gcc48_dll\mswud -J rc -O coff -i E:\OPENSO~1\testwx48\resource.rc -o obj\Debug\resource.res
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -D__WXDEBUG__ -Wmissing-include-dirs -Wfatal-errors -Wno-unused-local-typedefs -Wno-attributes -IC:\wxMSW-3.0\wxWidgets-3.0.0\include -IC:\wxMSW-3.0\wxWidgets-3.0.0\lib\gcc48_dll\mswud -c E:\OpenSourceCode\testwx48\testwx48App.cpp -o obj\Debug\testwx48App.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -D__WXDEBUG__ -Wmissing-include-dirs -Wfatal-errors -Wno-unused-local-typedefs -Wno-attributes -IC:\wxMSW-3.0\wxWidgets-3.0.0\include -IC:\wxMSW-3.0\wxWidgets-3.0.0\lib\gcc48_dll\mswud -c E:\OpenSourceCode\testwx48\testwx48Main.cpp -o obj\Debug\testwx48Main.o
mingw32-g++.exe -LC:\wxMSW-3.0\wxWidgets-3.0.0\lib\gcc48_dll -o bin\Debug\testwx48.exe obj\Debug\testwx48App.o obj\Debug\testwx48Main.o obj\Debug\resource.res -mthreads -lwxmsw30ud_core -lwxbase30ud -lwxpngd -lwxzlibd -mwindows
Output file is bin\Debug\testwx48.exe with size 1.75 MB
Hi,
i've same problem but I don't think that problem is only the __WXDEBUG__ option (checked or unchecked);
if i check this advanced option simply the problem becomes "... ld.exe cannot find -lwxmsw30ud" but in my environment
issue remains.
My build log is:
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -g -D__WXDEBUG__ -IC:\SourceCode\Libraries\wxWidgets3.0\include -IC:\SourceCode\Libraries\wxWidgets3.0\lib\gcc_dll\mswud -c C:\Users\W7onSSD\Documents\C_PROJECTS\monitor\monitorApp.cpp -o obj\Debug\monitorApp.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -g -D__WXDEBUG__ -IC:\SourceCode\Libraries\wxWidgets3.0\include -IC:\SourceCode\Libraries\wxWidgets3.0\lib\gcc_dll\mswud -c C:\Users\W7onSSD\Documents\C_PROJECTS\monitor\monitorMain.cpp -o obj\Debug\monitorMain.o
windres.exe -IC:\SourceCode\Libraries\wxWidgets3.0\include -IC:\SourceCode\Libraries\wxWidgets3.0\lib\gcc_dll\mswud -J rc -O coff -i C:\Users\W7onSSD\Documents\C_PROJECTS\monitor\resource.rc -o obj\Debug\resource.res
mingw32-g++.exe -LC:\SourceCode\Libraries\wxWidgets3.0\lib\gcc_dll -o bin\Debug\monitor.exe obj\Debug\monitorApp.o obj\Debug\monitorMain.o obj\Debug\resource.res -mthreads -lwxmsw30ud -mwindows
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lwxmsw30ud
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 4 second(s))
1 error(s), 0 warning(s) (0 minute(s), 4 second(s))
Problem (for me) is that wizard search in wxWidgets3.0\lib\gcc_dll\mswu or wxWidgets3.0\lib\gcc_dll\mswu when it doesn't exist. I solved changing $(#wx)\lib\gcc_dll\mswud to $(#wx)\lib\gcc48_dll\mswud in searching directory for compiler and resource compiler tabs and changing $(#wx)\lib\gcc_dll to $(#wx)\lib\gcc48_dll in linker tab.
What do you think ?
-Vit
UPDATE
I determined that the file libwxmsw30u.a was missing from the C:\wxWidgets-3.0.2\lib\gcc_dll directory, so I copied and pasted it from another pc with wxWidgets & CodeBlocks which operates and builds as properly.
Now, this is the latest build log:
-------------- Build: Debug in 6Martest (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -LC:\wxWidgets-3.0.2\lib\gcc_dll -LC:\wxWidgets-3.0.2\lib\gcc_dll -o bin\Debug\6Martest.exe obj\Debug\_MartestApp.o obj\Debug\_MartestMain.o obj\Debug\resource.res -mthreads -lwxmsw30u -mwindows
Warning: .drectve `-aligncomm:"___hexdig_D2A",5' unrecognized
/mingw/lib/libmingw32.a(setargv.o):(.text+0x30): undefined reference to `___chkstk_ms'
/mingw/lib/libmingwex.a(glob.o):(.text+0x673): undefined reference to `___chkstk_ms'
/mingw/lib/libmingwex.a(glob.o):(.text+0x7e0): undefined reference to `___chkstk_ms'
/mingw/lib/libmingwex.a(glob.o):(.text+0x81d): undefined reference to `___chkstk_ms'
/mingw/lib/libmingwex.a(glob.o):(.text+0x934): undefined reference to `___chkstk_ms'
/mingw/lib/libmingwex.a(glob.o):(.text+0xb78): more undefined references to `___chkstk_ms' follow
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 9 second(s))
6 error(s), 1 warning(s) (0 minute(s), 9 second(s))
Then I realized I had an old MinGW installed im my C:\ directory, renamed it 'zz_MinGW', and the build is successful.
Please note that my Link libraries list does not have that extra "l". The entries there are as follows
lwxmsm32ud
libshlwapi.a
libversion.a
Really? I see an extra 'l' as the very first character of your quote.
OTOH, are you sure you want to link with the debug version of wxWidgets?
EDIT: If this is a copy/paste of your setup, please note the "msm" instead of "msw"
Remove the leading 'l' and replace the wxWidgets's debug library with the production one. Write exactly this:
libwxmsw32u.a
libshlwapi.a
libversion.a
You do not need the debug version unless you intend to debug wxWidgets itself.