Sie sind auf Seite 1von 2

MinGW and Eclipse on Windows 7

Installing MinGW and Eclipse for C++ development on Windows 7


This set of instructions lists the steps needed to get a C++ development environment
up and running on Windows 7 using the MinGW set of tools integrated into the Eclipse
Integrated Development Environment (IDE)
1.
2.
3.

4.
5.
6.

7.
8.
9.

10.
11.
12.

13.

14.

15.
16.
17.
18.

19.

Read all these instructions through before beginning.


Start by reviewing the Eclipse instructions here: http://help.eclipse.org/indigo/
index.jsp?topic=/org.eclipse.cdt.doc.user/concepts/cdt_c_before_you_begin.htm
Download the latest version of MinGW Installer from: http://sourceforge.net/
projects/mingw/files/ It is after the Looking for latest version? And should be
named mingw-get-inst-YYYYMMDD.exe where YYYY is year, MM is month,
and DD is the day of the build.
This tutorial gives a good overview of installing MinGW: http://www.banym.de/
eclipse/install-eclipse-cdt-on-windows-7
Make sure to install MinGW in the default directory of C:\MinGW
When installing MinGW be sure to select the C++ Compiler component, the
MSYS Basic System, and MinGW Developer Toolkit (which includes the MSYS
Basic System)
I also chose to update the catalogues rather than using the ones shipped with the
installer.
It takes a few minutes for it to download the new catalogues and install it.
Go to Control Panel -> System and Security -> System -> Advanced System
Settings (off on left side of window) -> Environment Variables (button near
bottom)
Select the System Variable named Path and Click Edit
Add ; C:\MinGW\bin to the end, not forgetting the semicolon at the beginning
Open a command prompt (type cmd and then enter at the search blank on the Start
menu) and try gcc and then Enter. It should respond with: gcc: no input files.
Try g++ and it should respond the same.
My installation failed to install g++ so I had to open a command prompt
(cmd.exe), change directory to C:\MinGW\bin and run mingw-get install
mingw32-gcc-g++ at the command prompt (without the quotes)
Before you install Eclipse, you need to install a Java Runtime Environment
(JRE). These can be found at: http://www.oracle.com/technetwork/java/javase/
downloads/index-jsp-138363.html Note that Oracle owns Java now. I installed
JRE 7 and things seemed to work okay.
Installing Eclipse:
Go to: http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developersincludes-incubating-components/indigor
Download the version that matches your OS from the options on the right.
You will have downloaded a zip file, unzip it and move that directory to where
you want to run Eclipse from. There is no installation process, it just runs out of
that directory.
When you start up Eclipse, you will be asked for a default directory for your
projects.

MinGW and Eclipse on Windows 7

File -> New -> C++ Project


Select Hello World C++ Project, give it a name and press Next
Make sure that the Toolchain is MinGW GCC
Once the program shows up, click inside the .cpp program, then press the hammer
button just under the Window menu item. This should build the program.
24. Go back to the command prompt, change directory to the debug directory under
where you put the project. There should be a .exe file with the same name as your
project. Run it and it should print out Hello World on the command prompt.
20.
21.
22.
23.

Das könnte Ihnen auch gefallen