Using Eclipse to build a C + + development environment

Source: Internet
Author: User

Description: There are many similar tutorials online, but basically are very old version of Eclipse, the version of Eclipse changes too much, many of the online tutorials are wrong or superfluous, so close this tutorial to avoid more people detours.

Software Preparation: jdk_v1.6,eclipse_v3.7 "Integrated development Environment", cdt-master-8.0.2 "development of C + + required plugins", mingw_v5.1.6 "compilation Tool".

Recommended installation order: Install the JDK first, then MinGW, then eclipse, and finally add the plugin.

1, JDK nothing to say, omitted to write, the most important thing is to match the PATH environment variable.

2, install MinGW compiler, the first of course is download, online is easy to search the official website (this: http://sourceforge.net/projects/mingw/files/), but is generally installed online, and often download components fail, So it is recommended to download the offline installation package, click here to download, of course, you can also directly use the green version prepared by others, lest installation trouble. Here briefly to say the offline installation, after a few simple steps, will enter the following interface, not enough to select any project by default only install C compiler, generally will again g++ hook, is used to compile C + +.

3, then is the environment variable configuration, assuming MinGW installed in D:\Program Files (x86) \mingw directory, then with:

Path:d:\program Files (x86) \mingw\bin (if there is an old path, then add an English ";" in the Last Face) Semicolon, in paste)

Many tutorials on the web say there are 3 more to configure:

Library_path,c_include_path,cplus_include_path.

There is no problem with configuring only one path at the moment, and if anything goes wrong, add the 3 environment variables.

Test whether the MINGW is configured successfully: Win+r pop up the Run window, then tap "cmd" to open the command-line window and hit "GCC" test.

4. Installing CDT:

Of course, Eclipse also offers a dedicated C + + version of Eclipse, in fact, and our own common eclipse to install the CDT plugin is one thing, interested can click here to download.

Unzip the eclipse_v3.7, run, click "Install Software" under "Help", then specify the CDT plugin, install, install, will require restart eclipse.

Note: Do not use links or Dropins installation method to install the CDT plug- In, there will be a lot of problems, although there will be a C development environment, but compile, run and so will encounter a variety of problems, so remember!!!

5. Start testing:

Create a new "Hello World ANSI C Project" and choose "MinGW GCC" on the right, otherwise there will be a variety of problems. This will not occur if MinGW is not installed and the PATH environment variable is configured.

Project type is divided into two types, "executeble" and "Makefile Project", where "executeble" is managed C project, that is, the C project is automatically compiled, and "Makefile project" is by writing makefile to manually compile the C project, the Novice recommends the use of automatic compilation of the C project.

When you finish creating a new project, the default is this:

If you install the CDT plugin using link and so on, nothing will happen after you create a new project!

6. Operation:

Direct run will report "Binary not Found" error:

Note: Here is the most critical, any project, the first run must be right-to-the project name--"Build Project" (the English version is called Build projects), you will find some more directories and files come out, the console will have some information, in fact, this is the compilation, After you modify the project later, you don't need to build it again, just click to run it:

Then you can run it:

Click to run with the label or right:

Summarize some of the online error tutorials:

1, some said to the Mingw\bin under a call Mingw32-make.exe change to Make.exe, may be I did not install mingw32-make, at least I have not encountered any problems, because mingw\bin there is no such file.

2, there are said to own what makefile, also right-click the project "Make Targets"-"Build", knitting, ah, do not need any configuration on it.

3, there are said to be in the preferences, Select "C + +", "Make" and "New make Projects", on the right side select "Binary Parser" column, and then click on the "PE Windows Parser", and uncheck the other options, click "OK" after completion, and now found that this is superfluous.

4, there is also about the environment variable redundant configuration, here no longer rip.

Using Eclipse to build a C/D + + development environment (RPM)

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.