[Zz] Use eclipse to develop graphical configuration for C/C ++ programs

Source: Internet
Author: User

Reference http://www.javaworld.com.tw/Author: sungo

I found some development materials about eclipse on the Internet, but it is deeply attracted to the eclipse interface and its functions, in particular, I was ecstatic when I learned that eclipse could be used for C/C ++ development. At first, I was very familiar with the eclipse configuration. For a while, I wanted to find a graphical configuration on the Internet, but not found (maybe not found ). after unremitting efforts and learning, we finally achieved success. A graphical configuration document was created for the latter to stay less. now we will start to talk less.

I will not talk about the introduction of eclipse. I can ask www.baidu.com to ask Baidu. The software I use is:

OS: Windows XP

Eclipse 3.0.2

CDT runtime feature org. Eclipse. cdt-2.1.1-win32.x86

Cdt sdk feature org. Eclipse. CDT. sdk-2.1.1-win32.x86

MinGWStudioFullSetup-2_05

Part 1: Download eclipse from www.eclipse.org and decompress it on any disk. The running interface is as follows:

Part 2: Download the C/C ++ plug-in from www.eclipse.org/cdt

CDT runtime feature org. Eclipse. cdt-2.1.1-win32.x86

Cdt sdk feature org. Eclipse. CDT. sdk-2.1.1-win32.x86

Part 3: Download can use gnu c, C ++ compiler in windows, here is the MinGWStudioFullSetup-2_05, download and install it; of course you can also use mingw. Download URL: http://www.mingw.org/download.shtml
After installation, test compilation and execution in start-> Run-> cmd mode. Rename mingw32-make.exeunder c: \ mingwstudio \ mingw \ BINAS make.exe.
.
Targets view, when a task is added, build
Command to cancel use defaultand use mingw32-make.exe and Project
Properties-> make project-> change make to mingw32-make)

Add the following settings to the environment variables:

Path: C: \ mingwstudio \ mingw \ bin
(If the system already has other C/C ++ compilers, put c: \ mingwstudio \ mingw \ bin
Add to the beginning)

LIBRARY_PATH: C: \ mingwstudio \ mingw \ Lib

C_include_path: C: \ mingwstudio \ mingw \ include

 

Cplus_include_path: C: \ mingwstudio \ mingw \ include \ c ++ \ 3.3.1; C: \ mingwstudio \ mingw \ include \ c ++ \ 3.3.1 \ mingw32; C: \ mingwstudio \ mingw \ include \ c ++ \ 3.3.1 \ backward; C: \ mingwstudio \ mingw \ include

Use a text editor to write the test source program main. cpp.

# Include <iostream>

Using namespace STD;

Int main (void)

{

Cout <"Hello
World, eclipse! ";

Return 0;

}

Compile the command under command line:

C: \ G ++ main. cpp-O3
-O hello

(The O of O3 is in uppercase "O ")

After compilation is successful: the executable file hello.exe.run hello.exe

(Note: The-O3 mark is optimized by advanced compilation, and the compilation speed is the slowest, but the generated executable file is the smallest and the execution speed is the fastest. The-O mark is compiled *. EXE)

Part 4: Install the CDT plug-in.

CDT runtime feature org. Eclipse. cdt-2.1.1-win32.x86

Cdt sdk feature org. Eclipse. CDT. sdk-2.1.1-win32.x86

Decompress.

Set feature

Copy

Under. Copy plugins

Restart eclipse to view the C/C ++ programming environment.

Next we will run the above program once using eclipse,


First, set eclipse to a C/C ++ Development Platform:

Windows-> open
Perspective-> other... -> C/C ++


Build a C ++ Project

File-> New-> Project-> C ++-> Standard
Make C ++ Project

Then press the finish key.


You can import the original main. cpp file to the project, or create a new main. cpp file.

(1) The method to import the main. cpp file is as follows:

Then finish.

(2) the method for creating the main. cpp file is as follows:

Then write the program into main. cpp.


Next, we will create a makefile. The method is the same as the method used to create the main. cpp file.

Note: you must use the tab key to scale down the makefile. You cannot use four spaces as the tab. Otherwise, the following error occurs:


Make
Targets enables the program to run.

Windows-show
View-> make targets


Compile: Double-click to compile

7 *. settings before ext execution. Because you want to run in Windows, you need to set the settings first.

Open project> Properties> C/C ++
Make project-> binary parser page

Remove the elf parser entry and remove the PE
Windowsparser is selected.

Worker executes our program:

When the program is changed, you only need to execute the new six ~ Continue.

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.