Required tools: JDK + eclipse + CDT + mingw
A. The installation of eclipse and JDK is not described here. Install the CDT plug-in:
Install the CDT plug-in
1> download the CDT plug-in: You can select the appropriate version of your eclipse in the http://www.eclipse.org/cdt/, and then open the page to give the hyperlink, in the "Installing from a tar.gz or ZIP file" section, select the version you want, and then download the compressed package in the "CDT runtime feature" section.
2> install the CDT plug-in: You can decompress it to the same directory of Eclipse, that is, copy the entire features and plugins folder decompressed by the CDT compressed package to the eclipse installation file, and restart eclipse.
3> problem: if you cannot see CDT, C/C ++ is not found in eclipse. Select help-> Software Updates-> Manage configuration..., then you can see the CDT on the left. If no, press the third button on the toolbar to see the disabled CDT (3 ). Click Enable on the right and restart eclipse as prompted.
B. Install mingw
: Http://www.mingw.org/download.shtml or http://sourceforge.net/projects/mingw/files/
Version: MinGW-3.1.0-1.exe
1> Configure environment variables (important ):
Go to "my computer"> "properties"> "advanced"> "environment variables"> "system variables" and edit the following system variables:
Variable name variable value
Path D:/mingw/bin;
LIBRARY_PATH D:/mingw/lib
C_includede_path D:/mingw/include
Cplus_include_path D:/mingw/include/C ++/3.2.3; D:/mingw/include/C ++/3.2.3/mingw32; D: /mingw/include/C ++/3.2.3/backward; D:/mingw/include
Note: You can set the mingw installation path, for example, mingw installation path/bin, based on your own situation;
2> change
C:/mingw/bin under the "mingw32-make.exe" renamed to "make.exe", because eclipse uses the default "make" file name in the system, rather than "mingw32-make ". Of course, if you do not want to change the settings in mingw, you can also modify the settings in eclipse. When a new task is added in "make targets View", "Build command" cancels "use default" and uses "mingw32-make ". In addition, in "project properties-> make project", change "make" to "mingw32-make" (after eclipse
IDE configuration will be detailed ).
3> Test
(1) After the installation is complete, the setting of "system environment variables" is described as follows:
Edit the path and add "D:/mingw/bin;" at the beginning of the variable value. This sentence must be placed at the beginning to prevent conflict with VC /. make commands such as. Net conflict, and rename mingw32-make.exeunder D:/mingw/bindirectory to make.exe, and then execute the make command (such as D:/mingw/bin> make.exe) in cmd ), if "*** no targets specfied and no make file found stop" is displayed, the setting is successful. This does not affect the use of visual C ++ 6.0. Otherwise, the C/C ++ program compiled with CDT in eclipse cannot be compiled.
(2) Check whether mingw installation and environment variable settings take effect.
Enter "gcc-V" in cmd. If "GCC is not an internal or external command, or a program or batch file that can be run," appears on the screen ." Indicates that the environment variable settings are incorrect. If not, the setting is successful.
C. Configure Eclipse IDE for mingw
1> select windows => preferences... menu, In the preferences pop-up window, select C/C ++ => make => New make project left Tree node, set build command: mingw32-make in the make builder tab on the right. (If managed make C ++ project is used, build commandeline to make.exe)
2> to run make target in Windows, you must set binary parser in project => properties => C ++ make project to PE windows parser.
3> Configure the debugging environment: Click RUN => debug... menu, select the corresponding C/C ++ local application in the pop-up debug window, select the debugger tab on the right, and set Debugger: gdb debugger and gdb debugger: GDB
At this point, if nothing happens, eclipse can write/debug C ++ code.
D. Hello word
1> open the C ++ editing page: choose Window> open perspective> Other, select C/C ++, and click OK.
2> Create a project: file-> New-> Project: Select "managed make C ++ Project" in C/C ++, click Next, enter hello in the project name, and then click Next, on the C/C ++ indexer tab, if your machine is fast enough, select full C/C ++ indexer. Otherwise, select "No indexer" for "Fast indexer" and finish
3> Add code: file-> New-> Other: Select source file and next in C/C ++, and enter hello in the source file. CPP, (Be sure to write. CPP otherwise the program cannot be executed), and then finish. Then fill in the Code:
# Include <iostream. h>
Int main () // emphasize int main () Again, instead of Void
{
Cout <"Hello word! "<Endl;
Return 0;
}
Save
3> compile the project: the default project-> build automatically has been selected, and will be automatically compiled and linked after each save, if project-> build automatically is canceled, project-> build all can be compiled. To re-compile the project, you can select the project in the C/C ++ project window on the left (usually like this, right-click and select rebuild project.
4> Run: Run-> Run as-> Local C/C ++ application.
OK
Go to: http://blog.csdn.net/xuhaipeng/article/details/3978721