Eclipse + CDT + mingw security methods (C/C ++) (GCC) (G ++) (OS) (Windows)

Source: Internet
Author: User

In addition to developing Java, eclipse also supports many other languages. Of course C/C ++ will not be missed, now let's take a look at how to use eclipse to develop C/C ++ programs.
Use eclipse to develop the main steps of C/C ++:

1. Installing JRE
Because eclipse is developed in Java, you need to use JRE. If you have installed jre before, you cannot install it.
2. Installing eclipse
Of course there is no problem. We must renew it. Otherwise, how can we use it?
3. Compile the eclipse Chinese edition
If you don't mind using the English interface, you can skip this step.
4. Upload CDT
CDT is a plug-in that enables eclipse to develop C/C ++ programs. This is our main character and must be!
5. anw.mingw
This is to make your computer have the GCC, G ++ compiler. This is also necessary. Otherwise, how should we continue?
6. Security C ++ formatter
CDT does not have a formatting tool for program editing. You can use this tool if you do not have this requirement.

You can perform the following steps:

I. JRE 5.0 Security

‧ Lower education: http://java.sun.com/j2se/1.5.0/download.jsp or to the high school education website for JRE 5.0
‧ Select Download JRE 5.0 Update 5, Select accept, and then select Windows platform "Windows offline installation, multi-language"
‧ After the renewal, you can just install it.

Ii. Installing eclipse
First, go to the eclipse official website http://eclipse.org left to find download currently version 3.1 has been release, but there is no Chinese kit, if you have a deep fear of English, first use 3.0.x version, under the http://eclipse.org or to the high school education network under the eclipse 3.0.1 platform.
After the renewal, you can resolve the issue to the path you want to place, and pull the Jie.

Iii. Eclipse Chinese edition on idea
In the same way in the http://eclipse.org can find the Chinese package nlpack-eclipse-sdk-3.0.x-win32.zip or to the high school information education network under the eclipse 3.01 Chinese Language package
Copy the plug-ins and features after the NLpack-eclipse-SDK-3.0.x-win32.zip solution to the same category of Eclipse.
Then you can see the Chinese interface.
If you cannot see it or a small part of it is not completely Chinese, in your eclipse release, right-click to select the content and add-clean to the "project" and then click "OK !!
After normal operation, this-clean can be removed.

Iv. Upload CDT
Next, to enable eclipse to develop C/C ++ programs, you need to compile the CDT. First, you need to download CDT, download the website http://www.eclipse.org/cdt/find the org.eclipse.cdt-2.1.1-win32.x86.zip or to the high school education network under CDT 2.1.1
If your installed eclipse version is 3.0.x, you must install the latest version of CDT 2.1.1.
If the eclipse version of server guard is 3.1, you must install the CDT version 3.0.

Security: sends the entire features and plugins information after the release to the eclipse security information.
And re-open eclipse.

When a new case is created, we can see that C and C ++ have been selected, which indicates that the security has been successful.
If you cannot see it, add the-clean rows in the same way.

V. Server guard mingw
Up to now, CDT has been installed for Eclipse, but a "compiler" is required to compile the program.
Therefore, you need to download the gnu c, C ++ compiler that can be used on Windows. The following code is required: mingw.
Bottom site: http://www.mingw.org/download.shtml
Find the MinGW-3.1.0-1.exe in the following documents or go to the high school education website MinGW-3.1.0-1
PS:
Security Engineer: Select slot C for the security engineer, and click "Next. After the installation is complete, the path is like-> C: \ mingw.

Add the following settings to the environment changes:
Path: C: \ mingw \ bin;
For Windows users, choose "my computer"> "content"> "import"> "environment changes"> "System Changes"> "path" zookeeper"
Add c: \ mingw \ bin; at the beginning.

Because the name of the compiler used in eclipse is make.exe, but after mingw is installed, the make compiler name of the compiler is mingw32-make.exe.
So you can change the mingw32-make to make!

In order to enable CDT to use mingw for further debugging, we need to go back to eclipse to design
Examples window-> Settings-> C/C ++-> make-> New make project-> New Builder
Locate binary parser, cancel elf parser, and select PE windows parser.

Vi. Security C ++ formatter
C ++ formatter is a tool used to typeset C/C ++ programs. For example, it can be used to modify the edited program, this is really a life-saving thing. Let the program immediately return to the "elegant" shopping festival. Because the CDT plugin does not have any internal formatter, other tools are used. Here we want to use artistic style.
Astyle web site under the http://sourceforge.net/projects/astyle to buy astyle_1.15.3_win32.zip or to the High School of Information Education Network under the elastic astyle_1.15.3_win32.zip
After resolving the desired Shard, place it in the desired location.

In eclipse, we must use it with "external tools.

Set the following parameters for external tools:


 

Select "program", click "new"
Name: formatter

Location:
Find the location of astyle.exe according to "zookeeper tutorial system ...".

Job objectives:
$ {Workspace_loc:/$ {project_name }}

Reference:
-- Style = Kr $ {resource_name}

Select ""

All hosts have been installed.

Next I will compile a small program

Open eclipse-> Create a project-> C/C ++-> managed make C ++ Project

Point "complete"

In case test, right-click upload-> Add-> source file
Take a source file name example, remember to add the example name. cpp

Write this program into Alibaba

# Include<Iostream>
Using
NamespaceSTD;

IntMain (){
Cout <"Hello world! "<Endl;
Return0;
}

If you want to typeset the program, click "publish"-> external tools-> select formatter.

Sometimes there is no immediate response after the selection. At this time, as long as the dialog box is closed, the bottom dialog box appears.

Click "yes" to take effect.

And automatically saves the token when it is saved.

Click "Upload row"-> upload row as...-> Local C/C ++ Application
You can see the success result on the console !!

See also
(Original release) How does one use eclipse + CDT to develop C/C ++ programs in Linux? (OS) (Linux) (C/C ++) (GCC) (G ++)

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.