Dev-CPP Setup Guide
- 1 Dev-CPP Setup Guide
- 2 Common problems
- 3 Dev-CPP Alternate Setup Guide
Dev-CPP Setup Guide
This page describes the steps I took in order to get Dev-Cpp to work with a homebuilt wxWidgets. I was using Dev-Cpp 18.104.22.168 and wxWidgets 2.5 from CVS.
- Download Dev-Cpp from http://www.bloodshed.net/dev/index.html
- Download the wxWidgets DevPak http://michel.weinachter.free.fr/WxWindows-2.4.2.DevPak . You may not actually need this, but it conveniently installs some things into Dev-Cpp for you, so I think its useful.
- Download http://michel.weinachter.free.fr/imagelib-2.DevPak as well.
- You could also download the contrib devpack for some useful controls http://michel.weinachter.free.fr/WxWindows-2.4.2-contribs.DevPak.
- Install Dev-Cpp, just following the installer directions. It would be wise to make sure there are no spaces anywhere in the path.
- Install the imagelib DevPak by double-clicking it in your explorer window. This must be done before the next step, and (obviously) after the previous one.
- Install the wxWidgets DevPak by double-clicking it in your explorer window.
Now you have Dev-Cpp installed, and you can happily program wxPrograms. However, the wxWidgets build is not tailored to your system, ESPECIALLY in the regard that you have a final build of the wxWidgets libraries. This is good for production releases of your applications, but not so good for development. I, for one, spend quite a bit of time debugging any applications I create.
So, now we've discovered that we really need to have a homebuilt version of wxWidgets, with debugging information made available to us. This is how I got involved in the making of this wiki page; there is surprisingly little information out there to describe the integration of Dev-Cpp with wxWidgets. Now that I'm finished, perhaps it wasn't really all that hard.
Anyhow, on to building our own copy of wxWidgets.
Building your own wxWidgets Library
Download MSYS and compile wxWidgets as described in Compiling wxWidgets with MSYS-MinGW
At this point, you should have a working 'debug' version of wxWidgets. Now we need to integrate it with Dev-Cpp.
Integrating Dev-Cpp with the new Library
- Run Dev-Cpp.
- Open a wxWidgets project, and open the project options dialog.
- On the Parameters tab, enter the following for your c++ compiler options. ( -D__WXDEBUG__ -D__WXMSW__ -g -O0 -mthreads -Wall )
- On the Parameters tab, enter the following for your linker options. ( -mthreads -Wl,--subsystem,windows -mwindows -lwx_mswd-2.5 -lwxjpegd -lwxpngd -lwxzlibd -mthreads -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 -ltiff ) Note the library lwx_mswd-2.5. That will likely change depending on how your configure your build, and which version you are building, so just find it in the build lib folder, and grab the right name. ( libwx_mswd-2.5.a --> lwx_msw-2.5 )
- On the Directories|Library tab, enter the lib directory for your special build. ( mine is C:\wx\msw-debug\lib )
- On the Directories|Include tab, enter at least the following, per your own build :
- ( C:\wx\msw-debug\lib\wx\include\mswd-2.5 )
- ( C:\wx\include ) Note this is the MAIN include for your distribution, and not your special build.
- You may need to go into Tools|Compiler Options|Programs and change make.exe to mingw32-make.exe
- If you get an error about "duplicate sections" you probably have an old copy of one of the libs floating around.
Now, that should be all that is needed. Your Dev-Cpp ought to work with your new build now. To be careful, you might want to dive into the Dev-Cpp directories, and remove the earlier installed copy of wx and its include folder.
I hope this page is of some benefit to somebody. It took me a very long time to get everything working correctly.
If you have added all the neccesary library files to the linker options and there are still unresolved references you might have come around a rather strange "feature" of gcc (g++ 3.2): it's picky about the order you place the libraries. If you are using the xrc resource system the wxxrc library should come first. Then comes wxmsw and then the rest of the (wx)libraries you use. Set the following as linker settings and all should work fine:
-mwindows -Wl,--subsystem,windows -mwindows -lwxxrc -lwxmsw -lstdc++ -lgcc -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -ladvapi32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid
If you're using
wx/image.h (and maybe other things), you need to add the following libraries to the project settings as linker options:
-lpng -ltiff -ljpeg -lzlib
Cannot find -lwxmsw24
Maybe the library file is called slightly different. Look into the lib/ directories for a file called something like 'libwxmsw.a'.
Cannot find resource file
If you want to use wxWidgets resources (as for example the examples do), you need to add the '
\dev-cpp\wx\include' (from the top of my head is that the correct path?) directory to the 'resource file directories' in the project settings.
File not found during make
If making fails with something like:
process_begin: CreateProcess((null), D:Dev-C++Binmake -C ../../src/regex -f make file.g95 WXDIR=../.. WXWIN=../.., ...) failed. make (e=2): Le fichier specifu est introuvable
(translation: "the specified file cannot be found")
- not using the correct 'make' program: you should use MSYS make.
- making a mistake in the path to the 'extra tools'
- not having cp.exe installed
Solution for the latter:
- Download UnxUtils.zip from http://www.hristov.com/andrey/projects/php_stuff/UnxUtilsDist.html - Copy UnxUtils\usr\local\wbin\cp.exe to Dev-Cpp\bin\cp.exe
Dev-CPP Alternate Setup Guide
Dev-C++ is a nice Free IDE for Windows that works quite well with wxWidgets. See their website here
There is a binary package available in devpak (Dev-Cpp package format) available here, don't get the version from vUpdate (it is old). You need to install the newest (beta) version of devc++, but generally, it's worth it.
If you would prefer to build wxWidgets from the sources (recommended for those who can) download 2.4.0 and follow the MinGW build instructions in docs/msw/install.txt
- There are up-to-date instructions on setting up wxWidgets with Dev-C++ at the last two paragraphs.
- A tutorial on using wxDev-C++.
- A small tutorial in french on setting up wxWidgets with Dev-C++
- Using wxWidgets with Dev-C++ on the wxWidgets web site
- wxWidgets 2.5.2 DevPak : Available from here.
- The Agency Project has released an improved wxWidgets version 2.5.2 DevPak. This DevPak has been constructed to more closely reflect the configuration of a Visual Studio build and resolves platform dependent issues present in the previous release. The DevPak, wxWidgets-2.5.2-msw-mingw.DevPak, release is available from here.
- 2.8.4 DevPaks are available here (Note: French site). You need the header files (Fichiers entêtes et aide pour wxWidgets 2.8.4) and the ANSI/UNICODE, static/dynamic combination of your choice.