Configure the C/C ++ development environment using eclipse + CDT + mingw

Source: Internet
Author: User

Eclipse + CDT + mingw
Configure the C/C ++ Development Environment

 

 

Preface: I would like to share this document with all my friends who love and explore open source software.

 

 

1: First you have to have Java
Run the environment so that you can run eclipse, you can go to the http://java.com/zh_CN/
Download the latest version of JRE. If you install JDK
The JRE is included, and you do not need to install it again.

 

 

2: mingw
Download and install configurations

 

Download link: http://sourceforge.net/projects/mingw/files/

 

Here we download the installation file,

 

Open exe
Select "Next" for the file to go to the next step,

 

Next, select downloadand install.
(Download and install), and then click "Next" to go to the next step,

 

Select "current" and click "Next" to go to the next step,

 

In this step, select "full" for the component. You can also choose to install it. If you only write C/C ++
Then, Ada compiler and Java compiler
And so on. Click "Next" to go to the next step.

 

In this step, select the installation location. The default value is "C: \ mingw \". You can select the desired location. Click "Next" to go To the download and installation process,

 

 

Download the program and start downloading the selected components (the speed depends on your network speed ),

 

 

Click "finish" to complete the installation.

 

 

Mingw of the latest Board
GDB is not included. Here we will download and install it manually. Here, you will find multiple versions of GDB.
, I suggest selecting Release Candidate _ gdb-6.3
Gdb-6.3-2.exe in, installation location with mingw
Of course, you can also choose a higher version. The installation method is to decompress the package to overwrite the mingw.
Directory.

 

Http://sourceforge.net/projects/mingw/files/GNU%20Source-Level%20Debugger/

 

 

After installation is complete, we need to modify

 

1) c: \ mingw \ bin under the mingw32-make to make
(Default settings in eclipse)

 

2) set three environment variables in Path
Add c: \ mingw \ bin at the beginning. (After adding c: \ mingw \ bin, we can verify the GCC we need.
, Make, GDB
Whether the installation is successful. If the installation is not successful, the system will prompt what is not found)

 

Two additional environment variables are required.

 

Include = c: \ mingw \ include

 

Lib = c: \ mingw \ Lib

 

If the setting is successful, we will see it in the project created in eclipse.

 

 

If launchfailed binary not found occurs during program compilation
This prompt indicates that you correctly set the preceding three environment variables, and the problem may occur if one of them is missing.

 

 

 

3. Eclipse download: http://www.eclipse.org/downloads/ here we use eclipse classic 3.5.1

 

 

 

If you do not like E
Next Chinese Language Pack

 

Http://download.eclipse.org/technology/babel/babel_language_packs/galileo.php

 

 

We choose babellanguagepack-eclipse-zh_3.5.0.v20091121043401.zip (95.35%)

 

Chinese is perfect. Install features plugins
Copy the files in the two directories to the features plugins of the eclipse main program file.
Directory. Restart to see your dear Chinese.

 

4. CDT Installation

 

How to download the latest CDT
Decompress the package and copy it to the features plugins. At the beginning, you will be surprised to find that C \ c ++ appears.
Oh. Eclipse
Error launching external occurs info generator (GCC-e-p-v-DDD:/workspace /. metadata /. plugins/org. eclipse. CDT. make. core/specs. c)
Such an alarm. We found that specs. c encountered a problem and the next compilation failed. If you just do c \ c ++
I suggest you develop Eclipse IDE for C/C ++ developers
When you use this tool, you will find that the specs. c error does not appear. The younger brother does not know why. Please advise me here. I will try to use Eclipse IDE for C/C ++ developers
When the CDT is extracted in the version, it is overwritten to the eclipse classic
The specs. c issue does not occur during the version.

 

5. To make CDT
The ability to use mingw for compilation,
We will go back to eclipse to set the window->
Preference settings-> C/C ++-> make-> newmake project-> New Builder

Locate binary parser
Cancelling elf parser and selecting PE windows parser
Locate binary parser to cancel elf parser
Select PE windows parser, so that we have successfully built eclipse + CDT + mingw
C/C ++ development environment.

 

 

6. Start the first program in eclipse.

 




Startup screen (figure 1)

New-Project (Figure 2 );

 

 

 

Select C Project and name test.
(Figure 3 );

 

Click Finish (Figure 4)

 

Create a source file (figure
5)

 


If you set the environment variables correctly, they will appear in the test directory.
Des (figure 6)

 

 

 

Name helloeclipse. C (Figure 7
)

Press Ctrl + S to save the code (figure 8 ).
)

Create
Make targets is named
Test (Figure
9)

 

Right-click Test
Make targets
Build targets (figure
10)

 

 

 

In test, we can see that
Binary File (figure
11)

Right-click open with and you can select the display method you like (figure
12)

Here, CTRL + F11 will display the running result of the Program on the console (figure
13)

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.