Install eclipse 3.7 in Windows 7 to build a C/C ++ Development Environment (11:27:48)
Operating System:
Windows 7 SP1
Software:
JRE 1.6.0 _ 26-b03
Eclipse-SDK-3.7-win32
Cdt-master-8.0.0
Mingw-get-inst-20110530
1. Install JRE
Because eclipse is developed in Java, you need to use JRE (Java Runtime Environment). If you have installed jre before, you do not have to install it.
JRE: http://www.java.com/zh_CN/download/windows_ie.jsp? Locale = zh_cn
2. Install eclipse
Go to http://www.eclipse.org/downloads/download the eclipse classic version. The download link of eclipse classic 3.7 is as follows:
Http://www.eclipse.org/downloads/download.php? File =/Eclipse/downloads/drops/R-3.7-201106131736/eclipse-SDK-3.7-win32.zip
Decompress eclipse-sdk-3.7-win32.zip to c: \ Program Files, and create a shortcut for eclipse.exe on the table.
3. Install CDT
Go to http://www.eclipse.org/cdt/download the CDT (C/C ++ development tooling) corresponding to the matching sear. below is the download link of CDT 8.0:
Http://www.eclipse.org/downloads/download.php? File =/tools/CDT/releases/indigo/Dist/cdt-master-8.0.0.zip & url = http://mirrors.ustc.edu.cn/eclipse/tools/cdt/releases/indigo/dist/cdt-master-8.0.0.zip&mirror_id=1093
Open eclipse, go to the menu help, and select install new software ..., Click the Add button on the right. In the Add repository dialog box, click archive… in the lower right corner ..., Click "I accept the terms of the license agreement-finish", select "cdt-master-8.0.0.zip", double-click "All CDT components", select "I accept the terms of the license agreement-finish", and click "finish" to install CDT.
After the CDT is installed, restart eclipse.
4. Install mingw
Go to compute compiler and msys
Basic System, and then start to download and install.
During the installation process, two files cannot be downloaded and the installation is incomplete due to network reasons:
Mingwrt-3.18-mingw32-dev.tar.gz
Liblzma-4.999.9beta_20100401-1-msys-1.0.13-dll-1.tar.gz
The former can be found on the SourceForge website, while the latter cannot be found, but cannot be downloaded. Later, the first two files were downloaded through the Internet, using Baidu and Baidu, and then adding fg715p, copy them to the following path:
C: \ mingw \ var \ cache \ mingw-Get \ packages
Then re-run mingw-get-inst-20110530.exe to complete the installation.
5. Configuration
5.1 Environment Variables
My computer-properties-advanced system settings-Environment Variables
In the preceding user variables, perform the following operations:
(1) edit the PATH variable and add it to the end
C: \ Program Files \ mingw \ bin
C: \ Program Files \ mingw \ msys \ 1.0 \ bin
C: \ mingw \ mingw32 \ bin
(2) Add the LIBRARY_PATH variable with the following content:
C: \ mingw \ Lib
(3) Add the c_include_path variable with the following content:
C: \ mingw \ include
(4) Add the cplus_include_path variable with the following content:
C: \ mingw \ Lib \ GCC \ mingw32 \ 4.5.2 \ include \ c ++
Log out of windows and log on again. This step may be critical!
5.2 go to c: \ mingw \ binand copy mingw32-make.exeto make.exe. Because eclipse uses the "make" file name in the system by default, instead of "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, change "make" to "mingw32-make" in "project properties-> make project ". However, it is obvious that the latter one is more troublesome. We recommend the first one.
5.3 In order to enable the CDT to use mingw for compilation, we need to go to eclipse to set it:
Windows-> preferences-> C/C ++-> New CDT Project Wizard
On the right side of preferred toolchains, select mingw GCC in the toolchains column, and click make toolchain (s) preferred below:
Choose Windows> preferences> C/C ++> New CDT Project Wizard> makefile project> binary parser. Select only PE windows parser ,:
Now, the configuration is complete.
Well, let's start testing our first C/C ++ code to verify our results.
Basic Steps for a helloworld:
1. Open eclipse
2. Select a workspace)
3. Select a project)
4. Set the project name in the Wizard. Here we set the project name to helloeclipse. we need to pay attention to the storage path. If we select use default location, our location will be the path set in step 1, we usually need to set up subfolders to avoid the cross-cutting of different project files due to the increase in the number of projects. If you have a deep understanding of this, you can try both solutions.
In project types (project type), we can select a hello World ansi c Project and mingw GCC in toolchain, which is the compiler of our local machine.
5. Because we have selected the hello World project, we also have a page for basic settings to enter personalized information.
6. If you are using it on Windows, you can select Advanced Settings and the type of the binary converter (). Of course, it is selected by default, this part of the content will still succeed, but if you encounter such problems, you can check whether the settings are correct.
Related path: C/C ++ build-> Settings-> binary parsers
Click "OK" or "finish.
7. Try writing a code (in fact, the system has already generated a file for us in the SRC folder)
Let's try to write a simple code.
The Code is as follows:
#include <stdio.h>void myputs(char * s);int main(){char * s = "HelloEclipse!";myputs(s);return 0;}void myputs(char * s){while(*s){printf("%c",*s++);}return;}
In addition, there are many build-related options in the menu project. After you select build project, wait for the compilation to complete, click "run" (green icon), and find the console on the bottom tab, the output result is displayed.