DevPak for wxWidgets 2.6.0
Hi there everybody!
Since some of you complained about having trouble to get wxWidgets 2.6.0 compiled and running with Dev-Cpp, I decided to make a DevPak (for the lazy ones) out of it and write a short tutorial on compiling it (for the ones who like doing things themselves).
The pre-compiled DevPak version can be found on the bottom of this page...
If you want to compile it yourself, read the following explanation.
(Notice: This tutorial is about the "makefile" method, not building with MSYS using configure. I guess that if you've got all needed tools, building with MSYS should actually be easier and quicker. For information about building using configure see the install docs included with wxWidgets.)
- Download the latest wxWidgets zip package (2.6.0 is the latest stable release at the time of writing this)
- Unzip this package to some directory (e.g. C:\wx2). Be sure that the dirname doesn't contain spaces since this allways leads to trouble.
- Be sure to have the /bin (where your compiler and make are installed) directory included in your %PATH% variable.
Try it by going to the console and typing "gcc --version". If this gives you the version of gcc you're workinh with (e.g. 3.2), everything is ok.
(If you don't know what a "console" is and how to start/use it -> maybe consider downloading the devpak...)
If not: Look for the path where gcc and g++ are installed (typically something like "c:\dev-cpp\bin" if you use the standard setup) and include this path to your %PATH% variable ( e.g. set PATH=%PATH%;c:\dev-cpp\bin ).
- Since we'll be using the makefile method check if you got rm. If not -> get it.
- Change to the directory you unpacked wxWidgets to (I'll assume it is c:\wx2). Go to the \build\msw directory and open config.gcc in a texteditor.
- Check that GCC_VERSION is set to 3 ( GCC_VERSION=3 ).
- Open the file setup.h (in C:\WX2\INCLUDE\WX\MSW ). Set all the defines there to 1 if you need them, to 0 if you don't. For example the support for ODBC and GL is disabled by default, so be sure to enable it if you want to work with it.
- Copy this setup.h up one level ( to C:\WX2\INCLUDE\WX ). Not doing so may cause trouble later on when trying to compile your apps. So to avoid having to define everything by hand later on, copy it now and be happy...
- Now you should almost be ready to compile! :)
Set the %WXWIN% variable to the directory you unpacked wxWidgets to ( set WXWIN=C:\WX2 ). Although I think this is not really needed it is recommended by the install.txt.
- Since we're ready now, change to the \build\msw directory ( C:\WX2\BUILD\MSW )and let's rock!
You now have to decide what version of wxWidgets to build. You can have a DLL, a static, a Unicode and a debug version or a combination of those. What version you get depends on which defines you make. The standard (by giving no defines) is a static debug, no unicode version
The defines are as follows:
WXMAKINGDLL=1 - compiles a DLL
UNICODE=1 - compiles a unicode version
BUILD=release - compiles an optimized static version
MONOLITHIC=1 - compiles all sources into one big lib instead of several libs
Now use make to build the library.
e.g. make -f makefile.gcc BUILD=release MONOLITHIC=1 ( final static version )
make -f makefile.g95 BUILD=release MONOLITHIC=1 UNICODE=1 ( static unicode version )
make -f makefile.g95 BUILD=debug MONOLITHIC=1 UNICODE=1 ( static unicode debug version )
and so on...
Be carefull! It may happen that you'll be told that there is no command like make. In this case try mingw32-make ( make was renamed in the distribution of mingw ).
- Once the process started, go and make yourself some tea, coffee or whatever you like, cause this may take some time ( depending on your system ). For me it took about 15 min. on my Pentium 4 1600. Don't worry if you get some warnings during the compilation: It's ok!
- After the compilation don't close the console yet. Change to C:\wx2\samples\minimal and compile the minimal example ( make -f makefile.gcc MONOLITHIC=1 BUILD=release ). Note that you will have to use the same defines here that you used to compile the lib in order to find the correct lib. If you compiled the DLL use WXUSINGDLL=1.
- If everything is ok you will get a nice minimal example of a wxWidgets app. If not: Check that you did take all the steps mentioned above!
- All you have to do to get wxWidgets running with Dev-C++ is to either include the path to the libs and includes in Dev-C++, or copy the content of \lib and \include to the corresponding directories in your Dev-C++ directory. To go with the first method open Dev-C++, check "Tools"->"Compiler Options", change to the tab "Directories" and include the needed directories under "Lib" and "inlcude".
If you want to be able to easily update to a higher version of wxWidgets later on, go with the first version. That way you'll only have to delete the wxWidgets dir, install the new one, compile it and eveything should work. Updating the second version would mean to replace the \include\wx dir and the wxWidgets libs, which may be somewhat more work (I personally use the second setup with an external verion of mingw and updated successfully, so it can be done :)).
- Note that here we've set up the variables for PATH and WXWIN not to be permanent (so when you open a new console they won't be there)! If you want them to be permanent include the needed lines in your autoexec.bat or check the system options (Win2000/XP).
- If you want to save some space after compiling: The makefile has a "clean" target...
Using it should clean up the object files that were compiled for building the lib. If you don't need them, do a "make -f makefile.gcc clean".
Final steps (Dev-C++)
- The settings for your project should be as follows.
compiler settings: -fno-rtti -fno-exceptions -fno-pcc-struct-return -fstrict-aliasing -Wall -D__WXMSW__ -D__GNUWIN32__ -D__WIN95__
linker settings: -lwxmsw26 -lwxmsw26_gl -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregex -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32
Be sure to replace -lwxmsw26 with the lib you use. Debug = -lwxmsw26d, Unicode = -lwxmsw26u, debug & unicode = -lwxmsw26ud. The DLL version needs -lwxmsw260 (I guess.. better check it yourself)
Optionaly include -lodbc32 if you want to use ODBC and -lopengl32 for OpenGL.
This the way it worked for me. There is no guaranty whatsoever that it will work for you (although it should)!
If anything goes wrong: Don't blame me, I did my best. If your system is harmed in any way, it's not my fault!
The Devpack - 2.6.0
If nothing else works: Try the following devpak.
This is a new version of the devpack. It includes the FINAL version, the docs and the widgets example( sure, the docs are there too :) ).
It is highly advisable to deinstall any other version of wxWidgets DevPaks that where installed before to avoid problems!
wxWidgets version 2.6.0 - DevPak (about 8.8 MB)
wxWidgets ver. 2.6.0 - Contributions (about 1.6
MB)
wxWidgets ver. 2.6.0 - Samples (about 2.0 MB)
This wxWidgets devpak repository has other "devpaked" builds in different versions.
You can also try http://michel.weinachter.free.fr/ for another precompiled DevPack that seems to be quite famous and working.
I hope you succeded and this little piece helped a little. Sorry for my rather bad english and the sick layout of this page, hope you still got it...
upcase (René)
You can reach me at the wxWidgets forum
or you can drop me a line here