Eclipse CDT for Ganymede on Windows XP

CDT 5.0.x

CDT 5.0 runs with Eclipse 3.4 and is part of the Eclipse Ganymede simultaneous release. The main CDT feature can be installed from the Ganymede Discovery Site. This feature as well as all other CDT 5.0 features can also be installed from the CDT Ganymede Update Site with the following URL.

Setting up a compiler

Unfortunately Eclipse only provides the Integrated Development Environment (IDE) but it is missing the actual compiler.

Windows compiler

Windows doesn't come with a build-in compiler. You could try to install Visual Studio, but it is tricky to get that working with Eclipse. Therefore we will install MSYS. MSYS is part of the MinGW suite, which provides free development tools for Windows.

You will have to follow these 4 steps:

  • Download and install MinGW

  • Download and install MSYS

  • Set your path environment variable

  • Restart Eclipse if it was started.


First, you need to download MinGW. You can either click through the websites mentioned above or go directly to the MinGW download area. Look for the Package "Automated MinGW Installer". There, download the file ending in .exe. The file name should be something like "MinGW-5.1.4.exe". You can also download MinGW Version 5.1.4 from the link given here.

Most of the options in the MinGW 5 installer are pretty straightforward. I will point out some of the more tricky options.

The first one of such options is which "MinGW" package to install. Any of those should work just fine, but I would recommend Current.

Figure 1. MinGW 5 install

MinGW 5 install

MinGW will ask which components to install. Either select All or at least make sure that you have the g++ compiler checked. This is needed for C++ support.

Figure 2. MinGW 5 install (2)

MinGW 5 install (2)

When asked for the install folder, please do not change it. You will have a lot of trouble later on, especially if you chose a path that contains spaces.

Figure 3. MinGW 5 install (3)

MinGW 5 install (3)


If you want to use the debugger, you may have to install it separately.   Download it from  , look for a package starting with gdb and ending with .exe. 


gdb --version

should print the gdb version. 


Unfortunately MinGW is not enough. We also need the MSYS tools from the same download page :  . Go there again, to the "Current" section and look for "MSYS Base System". The one I used was :


MSYS install

If you accept all the default options, after a while there should be a black and white window, similar to this:


MSYS asking for postinstall

To continue the install type in y and then Enter. The next question reads like this:


MSYS asking for MinGW

Which you can also answer with y Enter. The next question is a little bit more tricky:


MSYS asking for path to MinGW

What they want to know is where you installed MinGW to and that you replace all backward slashes (\) by forward slashes (/). If you followed the instructions, the answer here will be:


Caveat: If you have not used the default paths, but instead have installed MinGW in a different location, such as C:/Program Files/MinGW, where the path contains spaces and / or is longer than 8 characters you may have to replace that particular path component with its DOS short pathname, such as C:/PROGRA~1/mingw.

The very last question just asks you to press a key:

Figure 8. MSYS installing correctly

MSYS installing correctly

Where you can press any key you like to continue. Setup will come back and ask you if you want to read a welcome note and the README file. You probably don't want either one, but it does not hurt to look. Anyways, once you hit "Finish" you are done with the setup. Now you have to set up your Path environment variable.

MSYS is done

Setting up Eclipse

Installing the CDT

In the "Help" menu select "Install New Software..."

Figure 16. Select Install New Software... from the help menu

Select Install New Software... from the help menu

This will show you the list of available software update sites. If you are luck you already have the CDT update site configured. Search for an entry which contains the String "cdt", for example If CDT is not available,, add it (using the "Add..." button), adding (the address may be different in future versions of Eclipse, this is for 3.5!)


Available Software Update page with Add... opened

When you have found the CDT site, it will give you two entries: CDT Main Features and CDT Optional Features. Expand both, and find the latest version of the CDT. Make sure you select at least the following:

  • Eclipse C/C++ Development Tools

  • CDT GNU Toolchain Build Support

  • CDT GNU Toolchain Debug Support

  • Eclipse C/C++ Development Platform


Select CDT from the Update Site

The select "Next..."

You will have to confirm the selection with "Next".

And accept the license agreement with "Finish".

Downloading and installing will take a while. Once its done it will ask you to restart Eclipse. This is a good idea, so select "Yes".


Restarting the workbench

Once Eclipse has restarted you now need to configure it for your computer.

Configuring the CDT

Fortunately, this is very easy. If your path is set correctly, there should be absolutely nothing you need to configure. This is especially true if you followed these instructions for Windows systems.

On some Unix systems you might have to change your "make" program to "gmake". You will find the setting in Window / Preferences. Then expand "C / C++", then "Make" and select "New Make Projects". At build command, de-select "use default" and at "Build command" enter "gmake".

Hello, World!

Once you are in Eclipse, you are given an empty workspace. You now have to start a new project. To do so, select "File" / "New" / "Project...". Expand the section "C++" and select "C++ Project", then click "Next >".


New Project screen

On the next screen, you have to give your project a name. In this case, it will be "HelloWorld", however, you may use any name you like. Also, you have to select a toolchain, if you followed my instructions you are using the GNU Toolchain, and it should automatically give you the right option. Click "Next".


New Project Name

The next screen contains some Basic settings. Fill in what you like:


Basic Settings

In the last setting you can chose output formats, it is always good to have a release and a debug configuration. Click "Finish".


New Project Platforms

Eclipse will now generate a few things, and then ask you if you want to switch to the C/C++ Perspective. This is a good idea, so say yes.


Perspective Switch

Great. You have a project now, and it does contain some sample code! You will immediately get an editor window for your project. Eclipse will also auto-build your project every time you save.


Example Hello World application

Now here comes the tricky part: On the left pane, select "C/C++ Projects", expand "Binaries" and you should see and executable (HelloWorld.exe). Now right-click that executable, and select "Run" / "Run Local C/C++ Application". If everything goes well your output will be in the bottom right window in the "Console" tab and it should say "Hello, World".


Running the example Hello World application

Congratulations! You have successfully installed a compiler, a build system and an IDE. You have successfully created, edited, compiled and run a project. You should now be able to start your own projects!