To learn C language and C ++, you first need a development platform that provides exercises. For C ++, there are many tools and platforms available, including Borland's c ++ builder and Microsoft's Visual Studio series, they are indeed very good.
Apart from these familiar development tools, do we have no choice?
For eclipse, many people know that it was developed for Java, but today we want to talk about how to use it with mingw, set up an efficient C ++ development platform.
Software preparation
1. Eclipse 3.06
Official site:
Http://www.eclipse.org
Eclipse tools: http://www.eclipse.org/downloads/index.php
2. C/C ++ Development Toolkit
: Http://update.eclipse.org/tools/cdt/releases/new/
Note that here we choose cdt-2.1.0-win32.x86
3. mingw 3.1
: Http://prdownloads.sf.net/mingw/MinGW-3.1.0-1.exe? Download
System Environment
Win2000/WINXP/win2003
Environment Configuration
After downloading all required tools, install mingw first. After installation, configure the environment variables of the system.
Click my computer Properties> advanced> environment variables> system variables> path
Add mingw installation path/mingw/bin after path, as shown in.
Next, find the directory where you installed mingw and change the name of mingw/bin/mingw32-make.exeto make.exe.
Next, install eclipse.
After the installation is complete, do not rush to run eclipse. Put the downloaded C/C ++ Development Toolkit's decompressed features and plugins directories under the eclipse installation directory.
At this point, the platform configuration is basically complete. Next we run eclipse. The system will prompt you to set the working directory to workspace, which is the place of the project file. Here we select the default recognition, the eclipse environment interface after running is shown in.
Next we will build a project
Select File ---> New ---> project...
In the displayed dialog box, select standard make C ++ progject, as shown in.
Select next and enter the project file name. Here we enter test to complete the project settings.
Next, expand the test project directory in the left-side navigator dialog box, right-click the mouse in the blank space, and choose new --> file, as shown in.
Next, enter the new C ++ file name in the pop-up dialog box. Here we enter hello. cpp.
Next, enter the C ++ source code in the edit dialog box. The Code is as follows:
C ++ code
# Include <iostream>
Using namespace STD;
Int main () { Cout <"Hello eclipse! /N "; System ("pause "); } |
|
To enable the eclipse environment to quickly compile the source file, we also need to set the compile control (make targets ).
Choose WINDOW> show View> make targets on some navigation bars in eclipse.
In the make targets dialog box that appears on the right, select the project test name, select Add make targets on the right mouse keyboard, and enter
Target name: Make File
Builder command: G ++ hello. cpp-g-o run. If it is a C environment, change it to GCC hello. C-g-o run.
Click create.
As shown in:
After the compilation is complete, click the make file branch in The make targets dialog box to compile the source file. After the compilation is complete, run will appear in the navigator dialog box. EXE, which is the executable file after compilation. You can double-click it to run it, as shown in.
By now, the eclipse + mingw Standard C/C ++ environment has been fully configured and tested. If you have any questions, visit the www.cndev-lab.com and ask questions in the discussion board. I will answer them.