How do I set up wxWidgets for Windows and CodeLite?

CTMacUser picture CTMacUser · Jul 26, 2013 · Viewed 10.2k times · Source

I'm trying out a new setup. I'm on a 32-bit Windows 8 Pro laptop. I've downloaded MinGW-builds' GCC 4.8.1. I used it to compile LLVM & CLang (3.4+ from a SVN copy of the trunk). Both of those are in my PATH.

I've downloaded CodeLite 5.2, which came with a copy of MinGW/GCC 4.7.1. I got the pure console tutorial example working, but I can't get the wxWidgets example working. (It's the Quick Start.) I downloaded & installed wxWidgets. (Always a good first step.) I built it with MinGW-4.8.1. I've read the error notes and added two (first local, now system) environment variables: WXWIN at "C:\wxWidgets-2.9.5" and WXCFG at "..\build\msw\gcc_mswud". (I initially thought WXCFG would be an absolute path, but it's based off of "%WXWIN%\lib\".) I moved my MinGW and LLVM builds out of "C:\Program Files" to "C:\" to avoid having a space in their paths.

Here's the (still) error output when I build with F7:

C:\WINDOWS\system32\cmd.exe /c "mingw32-make.exe -j 2 -e -f  Makefile"
"----------Building project:[ Test1_2 - Debug ]----------"

Please use the --wxcfg flag (as in wx-config --wxcfg=gcc_dll\mswud)
or set the environment variable WXCFG (as in WXCFG=gcc_dll\mswud)
to specify which configuration exactly you want to use.

Please use the --wxcfg flag (as in wx-config --wxcfg=gcc_dll\mswud)
or set the environment variable WXCFG (as in WXCFG=gcc_dll\mswud)
to specify which configuration exactly you want to use.

Please use the --wxcfg flag (as in wx-config --wxcfg=gcc_dll\mswud)
or set the environment variable WXCFG (as in WXCFG=gcc_dll\mswud)
to specify which configuration exactly you want to use.

Please use the --wxcfg flag (as in wx-config --wxcfg=gcc_dll\mswud)
or set the environment variable WXCFG (as in WXCFG=gcc_dll\mswud)
to specify which configuration exactly you want to use.
mingw32-make.exe[1]: Entering directory `C:/Users/Daryle/Documents/CodeLite/Test1/Test1_2'
g++: error: wx-config: No such file or directory
g++: error: Error:: Invalid argument
g++: error: No: No such file or directory
g++: error: valid: No such file or directory
g++: error: setup.h: No such file or directory
g++: error: of: No such file or directory
g++: error: wxWidgets: No such file or directory
g++: error: has: No such file or directory
g++: error: been: No such file or directory
g++: error: found: No such file or directory
g++: error: at: No such file or directory
g++: error: location:: Invalid argument
g++: error: C:\wxWidgets-2.9.5\lib\..\build\msw\gcc_mswud\wx\setup.h: No such file or directory
g++: error: wx-config: No such file or directory
g++: error: Error:: Invalid argument
g++: error: No: No such file or directory
g++: error: valid: No such file or directory
g++: error: setup.h: No such file or directory
g++: error: of: No such file or directory
g++: error: wxWidgets: No such file or directory
g++: error: has: No such file or directory
g++: error: been: No such file or directory
g++: error: found: No such file or directory
g++: error: at: No such file or directory
g++: error: location:: Invalid argument
g++: error: C:\wxWidgets-2.9.5\lib\..\build\msw\gcc_mswud\wx\setup.h: No such file or directory
mingw32-make.exe[1]: *** [Debug/test1_2_frame.o.d] Error 1
mingw32-make.exe[1]: *** Waiting for unfinished jobs....
mingw32-make.exe[1]: *** [Debug/test1_2_app.o.d] Error 1
Test1_2.mk:102: recipe for target `Debug/test1_2_frame.o.d' failed
Test1_2.mk:94: recipe for target `Debug/test1_2_app.o.d' failed
mingw32-make.exe[1]: Leaving directory `C:/Users/Daryle/Documents/CodeLite/Test1/Test1_2'
mingw32-make.exe: *** [All] Error 2
Makefile:4: recipe for target `All' failed
0 errors, 0 warnings

At some point, a compiler step spewed out an error message and the next step interpreted it as actual parameters! (Should have sent the error on stderr instead of stdout?)

Update

After moving on to my actual work, I got errors and noticed that CodeLite is still using the MinGW 4.7.1 that came with the CodeLite download instead of using the 4.8.1 I downloaded. I probably messed things up by changing the search directories to my 4.8.1. I think I'm going to erase everything and start over....

Answer

Eran picture Eran · Jul 27, 2013

wx-config.exe tool for Windows uses 2 environment variables: WXCFG and WXWIN You need to provide them so wx-config.exe will be able to locate wx-config files. The recommended way is to set them within the IDE and not system wide.

To do this, from within the main menu, go to: Settings -> Environment Variables

and add 2 entries:

WXWIN=\Path\to\wxWidgets\Folder
WXCFG=gcc_dll\mswu

Also, you mentioned that codelite is using GCC4.7.1 and not your 4.8.1. You should know that when working with GCC on Windows you should have all your components built with the same GCC version. so make sure that you don't use wxWidgets that we (codelite team) provide since it was built with GCC4.7.1 or you might get some weird crashes.

To force codelite to use another GCC, simply alter the PATH from within codelite:

Settings -> Environment variables

PATH=\Path\To\MinGW-4.8.1\bin;$PATH

Eran