Wednesday, April 1, 2009

Eclipse IDE: How to install and configure MinGW GNU C++ compiler for Windows

Eclipse IDE has the very nice CDT environment for C++ programming.

In order to use it under Windows, you have to install a C++ compiler.

Our suggestion is to install the MinGW compiler, "A MINimalistic Gnu for Windows" Gcc compiler.

Go to http://www.mingw.org/ and download the installer for Windows from here.

Then start the Installer and choose to install the basic package + the g77 compiler + Make for MinGW, as those are the tools needed for compiling C++ code with Eclipse... and not only with Eclipse ;-)

Once installed everything you have to add the MinGW path to your PATH environment variable, to make the compiler findable.

Let's say we have installed the MinGW package on C:\MinGW. Refer to the picture below.
You have to open Start --> Control Panel --> System. In the pop up window that appears select on the left side "Advanced System Settings" and then goes to the tab Advanced and choose "Environment Variables...". There look for the "Path" variable in the System Variables window below (look for PATH, instead, if you want to set the MinGW compiler only for you as user) and click on "Edit...". In the pop up window you'll find a long string to edit. Go to the end of that string line and add ";C:\MinGW\bin". Then "Ok" and again "Ok".





Now your new nice MinGW compiler is ready to be used.

To make a test open a new command prompt (Start --> All Programs --> Accessories --> Command Prompt) and try to type "mingw32-make --version". If everything worked fine you should see a window telling you the version of the newly installed package.

Now open your Eclipse IDE with CDT for C++. Eclipse now should see and should be able to use MinGW C++ compiler!! :-)

So...have fun programming C++! :-)

0 commenti: