Eclipse, CDT & MingW Setup Guide

From WxWiki
Jump to: navigation, search


Currently, I'm updated my configuration, so I'm able to write about a second working tool chain.

Eclipse-3.2, CDT-3.1 & MinGW-3.1.0-1.exe

First and the older version:

  • OS: WinXP Professional SP2
  • MingW: MinGW-3.1.0-1.exe (~15MB) without MSYS
  • wxWidgets-2.8.0
  • Eclipse-3.2 with CDT-3.1

Eclipse-3.3.2, CDT-4.0.3 & MinGW-5.1.3

And this is the newest version:

  • OS: WinXP Professional SP2
  • MingW: MinGW-5.1.3.exe (~23MB) without MSYS
  • wxWidgets-2.8.7 (port wxAll)
  • Eclipse-3.3.2 with CDT-4.0.3

--Schmmichael 06:36, 29 January 2007 (PST)

Install MinGW


For installing MinGW-3.1.0-1.exe double click on this file. I installed it on "C:\MinGW\bin". Now you should put the path into the path environment variable. I hope you know how to do this under winXP! Be sure, it's the only compiler in your path. So if you have installed cygwin and or msys remove these entries from your path. To see if everything is ok, enter at the command prompt: mingw32-make --version. Something like in the next box should appear.

GNU Make 3.80
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

So now everything is okay.


Do the same like under MinGW-3.1.0-1.exe. Only if you enter "mingw32-make --version", another version should be prompted.

GNU Make 3.81
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

So now everything is okay.

--Schmmichael 06:37, 29 January 2007 (PST)

Install wxWidgets-2.8.x


This part is more interesting as the section about MinGW. First, if you haven't done it already, download wxWidgets-2.8.x.tar.bz2. I unpacked it and moved the unpacked directory to "C:\wxWidgets-2.8.x". Now let's open the command prompt and go to "c:\wxWidgets-2.8.x\build\msw". To compile wxWidgets with MSW you have to enter:

mingw32-make -f makefile.gcc BUILD=debug SHARED=0 UNICODE=1 USE_ODBC=1

Note: This might take quite a while (circa 10-30 minutes).

As of January 30, 2008 this does not quite work. makefile.gcc makes directories and deletes files and than errors on "/usr/bin/sh -c". To do a build with MinGW follow the instructions here: Compiling wxWidgets with MSYS-MinGW. However, TDM's MinGW Installer (tested with version 1.902.0) plays very nicely with wxWidgets-2.8.9 and compilation works till the end (tried March 3, 2009).

At this point, wxWidgets should be compiled and the libraries will be at "C:\wxWidgets-2.8.x\lib\gcc_lib\mswud". The last directory name shows you that it is compiled with UNICODE and DEBUG options. To compile RELEASE libraries you have to enter the same like above but change the BUILD-option.

mingw32-make -f makefile.gcc BUILD=release SHARED=0 UNICODE=1 USE_ODBC=1

While compilation, following libraries are created inside the "C:\wxWidgets-2.8.x\lib\gcc_lib" directory:


  • libwxbase28ud.a
  • libwxbase28ud_net.a
  • libwxbase28ud_odbc.a
  • libwxbase28ud_xml.a
  • libwextpatd.a
  • libwxjpegd.a
  • libwxmsw28ud_adv.a
  • libwxmsw28ud_aui.a
  • libwxmsw28ud_core.a
  • libwxmsw28ud_dbgrid.a
  • libwxmsw28ud_html.a
  • libwxmsw28ud_media.a
  • libwxmsw28ud_richtext.a
  • libwxmsw28ud_xrc.a
  • libwxpngd.a
  • libwxtiffd.a
  • libwxzlibd.a


  • libwxbase28u.a
  • libwxbase28u_net.a
  • libwxbase28u_odbc.a
  • libwxbase28u_xml.a
  • libwextpat.a
  • libwxjpeg.a
  • libwxmsw28u_adv.a
  • libwxmsw28u_aui.a
  • libwxmsw28u_core.a
  • libwxmsw28u_dbgrid.a
  • libwxmsw28u_html.a
  • libwxmsw28u_media.a
  • libwxmsw28u_richtext.a
  • libwxmsw28u_xrc.a
  • libwxpng.a
  • libwxtiff.a
  • libwxzlib.a

Two more directories are created, one named "mswud" and the other one named "mswu"


For testing, go to a sample directory e.g. (in my case) "c:\wxWidgets-2.8.x\samples\minimal" and compile it with the same options as you compiled the wxWidgets.

mingw32-make -f makefile.gcc BUILD=release SHARED=0 UNICODE=1 USE_ODBC=1

If you don't do that, the libraries won't be found!

Download, install & config Eclipse/CDT

Let's download, install and config Eclipse and CDT.

Because I'm using now the newer version of Eclipse and this is quite changed at some positions compared to version 3.2.x. Following numbers will help to differ between this versions:

  1. Eclipse-3.2.x: 3.2
  2. Eclipse-3.3.x: 3.3

The entry point for the CDT-Project on the eclipse homepage is CDT - Eclipse .


3.2 Download Eclipse version 3.2.x (about 120MB for Windows) or
3.3 Download Eclipse/CDT version 3.3.x (about 60MB for Windows and only C/C++ developers)


The downloaded file should be a *.zip file, so installation must be done without windows installer. But in the case of eclipse, this is really very easy. Unzip the file. Make a copy of the new directory which has the same name like before but without zip ending. I put it to c:\Programme\ and renamed it to eclipse only. So the complete path is c:\Programme\eclipse. Inside this directory an eclipse.exe exists, which is the application we will configure. Make a shortcut on your desktop or in your quick launch bar.

To install CDT I hope you have minimal experience with eclipse. Go to Help - Software Updates - Find & Install.... Now choose Search for new features to install. Than click on New Remote Site... and enter "". So this will install CDT in your eclipse installation. I installed CDT-3.1.1, please do the same to be as sure as possible that the same configuration will work.

Configure Eclipse

To configure eclipse we must - of course - start eclipse first. During startup the workspace launcher will appear on the screen. Define whatever you want. When the startup of eclipse is finished we need to change to the c++ perspective. So click in eclipse on Window/Open Perspective/Other.... Chose c++ and click on ok. The appearance will change to the c++ perspective.

Now let's create a new project. Click on File/New/Managed Make C++ Project. A New Project dialog should be now on the screen. Enter the project name, in this example minimal to see if we can compile the minimal sample of the wxWidgets source. Now you can change the workspace location for this project if you like. In my case I changed the location to "U:\Daten\programming\wxWidgets\minimalWidget". Click Next. Project Type should be "Executable (Gnu on Windows)" and in the configurations section chose (if isn't already done) both, means Debug and Release. Click again on Next. Now you can click without any change on Finish.

Debug configuration

Now we will check which configuration is currently active. For this, click on "Project/Active Build Configuration/". Please be sure the debug configuration is active. If you have done this part click on the created project to mark the name minimal. Than a right-click with the mouse and chose "Properties". Now the "Properties for minimal" dialog will open on the screen.

Please click on C/C++ Build. In the Active configuration Debug should be visible, if not change it to Debug. For the next step, go to the Environment tab and under Environment variables the Configuration tab should be activated. Click on New to create a new User Variables. Enter PATH. Now your complete system path should appear in the Value field. Delete everything excepting the path to your MinGW installation e.g. "C:\MinGW\bin". Delimiter should be ; and in the field Operation chose Replace. Click on OK.

Now go to the Tool Settings tab. In the GCC C++ Compiler section click on Preprocessor (attention: in CDT 3.1.2 you will find the symbols under the seperate option Symbols, directly under Preprocessor). Add to Defined symbols (-D) __WXMSW__ (attention, please make 2 underscores before AND after WXMSW), __WXDEBUG__ and _UNICODE (only one underscore and of course only if you have compiles the libraries with unicode support). Than you can change to Directories. Add to Include paths (-I) "C:\wxWidgets-2.8.0\lib\gcc_lib\mswud" (in my case!!!), "C:\wxWidgets-2.8.0\include" and "C:\wxWidgets-2.8.0\contrib\include". Now you can change to Miscellaneous and enter in the field Other flags -c -Wundef -Wno-ctor-dtor-privacy -fno-strict-aliasing.

Now make a jump to the "GCC C++ Linker" section. Click on "Libraries". Enter the libraries in the following order:

  1. wxmsw28ud_xrc
  2. wxmsw28ud_richtext
  3. wxbase28ud_net
  4. wxmsw28ud_dbgrid
  5. wxbase28ud_odbc
  6. wxmsw28ud_media
  7. wxmsw28ud_aui
  8. wxmsw28ud_html
  9. wxmsw28ud_adv
  10. wxbase28ud_xml
  11. wxmsw28ud_core
  12. wxbase28ud
  13. wxtiffd
  14. wxjpegd
  15. wxpngd
  16. wxzlibd
  17. wxregexud
  18. wxexpatd
  19. kernel32
  20. user32
  21. gdi32
  22. comdlg32
  23. winspool
  24. winmm
  25. shell32
  26. comctl32
  27. ole32
  28. oleaut32
  29. uuid
  30. rpcrt4
  31. advapi32
  32. wsock32
  33. odbc32

Add to "Library search path (-L)" (again in my case!!!) "C:/wxWidgets-2.8.0/lib/gcc_lib" and "C:/wxWidgets-2.8.0/lib". Now the last change, click on "Miscellaneous" and enter in the field "Linker flags" -Wl,--subsystem,windows -mwindows. Click on Apply.

And last but not least, go to "Build Settings" tab, uncheck "Use default command", and enter new build command as "mingw32-make -f makefile". This will have Eclipse use mingw32-make rather than make command. That's it, click on Apply and then on OK.

That's all. Let's go and enjoy!

Test the debug configuration

To test this configuration, I copied the minimal.cpp, minimal.rc, sample.ico into my project workspace. Press F5 will update the screen (maybe you have to press F5 several times, eclipse isn't very fast!!) and the files should be visible under the minimal directory. Mark minimal again and click on "Project/Build Project". BTW, I deactivated the build automatically. Now you should be able to compile and run the debug binary.

Release configuration

Do the same like under Debug configuration. The library names shouldn't have a d at the end. In the "Preprocessor" section, you don't have to define __WXDEBUG__. That's it.

Known problems

If I compile the minimal sample and run the executable in the top left corner, I can't see the icon. If someone knows how I can change this, please write it to this page. Thanks a lot.

A first Solution

I have defined a batch file called win32ResourceFile.bat with following content:

windres --use-temp-file -isample.rc -ominimal_sample_rc.o

I saved it in the same directory like the other files of the project so you can see it in eclipse. Then define an external tool with which you can call the bat file. This will create minimal_sample_rc.o in your project directory (not under the Release or Debug directory). One more time we have to open the project properties dialog. Go to the Linker section and define in Miscellaneous/Other Objects the path including the new minimal_sample_rc.o. That's it. A more detailed description will follow.