With the powerful functions of ecplise, we can develop C/C ++ programs by adding CDT plug-ins to ecplise. The following is the summary process for configuring the CDT plug-in, it is mainly used to help you practice demo programs in the future. The compiling environment uses cygwin. Use ecplise4.2 + cdt8.1.2 + cygwin2.774. We recommend that you read the 6th notes first.
Strongly mind:Install and configure cygwin before installing the CDT plug-in
1. Installation Steps
To ensure smooth installation, follow these steps.
1. Install cygwin
: Http://cygwin.com/setup.exe Official Website: http://cygwin.com/
After the download is complete, click setup.exe to install it. The page shown in is displayed.
Click "Next" and we will see the following interface:
We can see three installation modes:
Install from Internet. This mode is directly installed from the Internet, which is suitable for fast network speed;
Download without installing. In this mode, only the cygwin package is downloaded from the Internet, but not installed;
Install from local directory. This mode corresponds to the second mode above. When your cygwin package has been downloaded to the local machine, cygwin can be installed locally in this mode.
Select the appropriate installation mode from the above three modes. Here we select the first installation mode, which is directly installed on the Internet. Of course, when downloading the cygwin component, it is also saved to the local device, so that you can install it again later. Click "Next ".
In this step, select the installation directory of cygwin and set some parameters. The default installation path is c: \ cygwin \. You can also select your own installation directory and then select "Next ",
In this step, we can select the location where the cygwin package downloaded from the internet is saved during the installation process. After selecting it, click "Next ",
In this step, select the connection method, select your connection method, and click Next. The Select Download Site dialog box is displayed, as shown in,
In this step, select the first image website provided by 163. The download speed in China is quite fast. If there are other images, enter the URL and click "add" to add them, then, select from the list. After the selection is complete, click "Next". After downloading several files, the following page is displayed:
Next we will download the packages for compiling C/C ++ code in this interface. We only need to download"Devel"Just a few packages under the Branch,
GCC,
Gcc-core,
Gcc-G ++,
Gcc-mingw-core,
Gcc-mingw-G ++,
Make,
GDB,
Binutils.
Enter GCC in the search box, and the program will automatically search. For example,Devel"Branch package, find the package we need to install, and then click skip to select the latest installation package
This is an illustration after the latest version is successfully installed. Click "Skip" to select the latest version for installation.
Similarly, input "make" and select"Devel"Package under the Branch, downloaded package:
Enter "GDB" and select"Devel"Package under the Branch, downloaded package:
Enter "binutils" and select"Devel"Package under the Branch, downloaded package:
After the selection, select next to go to the installation process, as shown in,
The installation time depends on the selected components and network conditions. After the installation is complete, the installer will prompt whether to create the cygwin icon on the desktop, and click Finish to exit the installer.
2. Configure Windows Environment Variables
If you are familiar with the Java development environment, you should know how to find the environment variables. If you do not know how to find the environment variables, go to the next level.
Add the cygwin \ bin directory to the environment variable path. Then, open the CMD command line window and try the GCC and G ++ commands respectively.
If "Access Denied" is displayed, go to cygwin installation directory \ binand check whether gcc.exe is only 1 kb in size. If yes, the file is a symbolic link, rename the file (Backup ). After all, replace g‑0000-3.exe(‑g‑0000-4.exe‑beibeibeibeian, and rename it g‑0000.exe. Rename gcc-3.exe‑beian as gcc.exe.
3. Download The ecplise CDT plug-in
: Http://www.eclipse.org/cdt/downloads.php
Refer to the four installation methods for the ecplise plug-in.
You can also use the ecplise automatic upgrade function to install the tool, as shown in:
Add address: http://download.eclipse.org/tools/cdt/releases/juno
4. Configure the C/C ++ development environment for ecplise
(1) set the path ing between ecplise and cygwin
To open ecplise, follow these steps:
Window-> preferences-> C/C ++-> debug-> common source lookup path-> Add-> New "path mapping ".
Ing methods, such:
During debugging in eclipse, due to the Unix format path used by GDB, while eclipse uses the Windows path, the matching Code cannot be found, and the Linux path is mapped to the Windows path: for example, MAP/cygwin/C to c :\.
(2) configure the "makefile project" of C/C ++ and select "PE windows parser" and "cygwin PE Parser.
5. Create a project in ecplise and write C/C ++ code
(1) create a C/C ++ Project
Click "Next", as shown in:
Click "Next", as shown in:
Click "finish" to complete the creation.
After writing the code, you can compile your project and click "Builder project" under the "project" option.
Shows the compiled project:
The "consloe" console is displayed after compilation.
Click the selected one, right-click, and select "run" to run the program. Now the console can print the text.
Now we have completed the ecplise + CDT + cygwin Development Environment configuration, and you will be able to enjoy its convenient functions later.
6. FAQs
1. When CDT under eclipse is used to create a C ++ project, the replicdes folder cannot be automatically generated.
There are two solutions:
(1) Open Window> preferences> C/C ++> environment, as shown in, add two environment variables.
Set c_include_path to/usr/include
Set cplus_include_path to/usr/include/C ++
If the directory c ++ does not exist in the/usr/include/directory of cygwin, you can copy a file from \ cygwin \ Lib \ GCC \ i686-pc-cygwin \ 3.4.4 \ include \ c ++ to the directory, or directly add this directory.
This step can also solve the problem of "unresolved encoding sion:" displayed in the Code. Although the compilation is not affected, the symbols in the header file cannot be located.
(2) In Windows, add the environment variables cplus_include_path and c_include_path, and set them to the Lib path of cygwin installed: D: when \ cygwin \ Lib is created and the C/C ++ project is created, the program des folder can be automatically created.
2. An error message "symbol cocould not be resolved" appears when you build and compile a C ++ project using eclipse"
Cause: the source lookup path in debug is not correctly mapped.
Solution:
Window-> preferences-> C/C ++-> debug-> source lookup path> path Mapping
\ Cygdirve \ c :\
Use drive C under cygwin to replace the current drive C to find the required library file. If cygwin is installed on drive C, it maps to drive C. If cygwin is installed on drive D, the ing is \ cygdirve \ d: \. The same applies to other disks.
3. An error occurred while compiling the C ++ debug project using eclipse. the following error is prompted:
Still the above ing problem. Open cygwin terminal, which comes with cygwin, and then enter the following command "Mount ":
The above is the ing we set. If you do not have the ecing of the disk where your ecplise workspace is located, please follow the instructions above to complete the debugging. For example, if my workspace is under D: disk, I want to debug the program, which must be mapped to the D disk.
4. solve the problem that the running results of C/C ++ programs compiled by CDT in eclipse cannot be output to the console.
(1) set the "Environment" option in "Debug deployments", add a path, and specify the path of X: \ cygwin \ bin.
(2) If the build fails
(After compilation is successful, output similar to the following will appear)
***** Build of configuration debug for Project Test ****
Make all
Make: Nothing to be done for 'all '.
* *** Build finished ****
Follow the steps above to reinstall.
Source: Xixi finishing Author: Xixi
Web: http://www.cr173.com/html/19980_1.html