Eclipse CDT

来自开放百科 - 灰狐
跳转到: 导航, 搜索

Eclipse C/C++ Development Tooling - CDT

CDT 3.1 runs on Eclipse 3.2 need install Eclipse Graphical Editing Framework

CDT Eclipse 3.1.x Based Releases (CDT 3.0.x)


Install CDT

At first install Eclipse Graphical Editing Framework

and then install CDT

uninstall CDT

1. Shutdown the eclipse shell that is running CDT

2. Remove the CDT plugins

  • Navigate to the directory where the CDT plugins are installed (typically eclipse/plugins)
  • Remove the following plugins: org.eclipse.cdt.*

3. Remove the CDT metadata

  • Navigate to the workspace/.metadata/.plugins directory
  • Remove the following directories (if they exist): org.eclipse.cdt.*

4. Restart Eclipse


Creating a simple Managed C++ Project

This section will use an example to create the familiar "Hello World!" C++ program. First, ensure that you have the CDT installed within Eclipse, as described above. Open a C/C++ Perspective and complete the following steps:

1. Click "Projects" from the menubar and ensure there is no checkmark beside "Build Automatically" -- if there is one, click "Build Automatically" to deselect it. ("Build Automatically" disables the build menus and buttons; you may want to turn it on later to avoid having to rebuild manually when modifying your projects.)

2. In the "C/C++ Projects" View, right click and select "New Project ..."

3. Expand "C++", then select "Managed Make C++ Project"

4. Enter a name for the new project and select "Finish". Note: you can determine the build Settings from this dialog, but we will do so later, in the build section.

5. In the "C/C++ Projects" view, right click and select "New" > "File". Name your file "hello.cpp" and click "Finish".

6. Copy or type the following text into the "hello.cpp" file:

    #include <stdio.h>
    int main()
        printf("hello, world\n");

7. Save the file.

There are several ways to initiate builds and to run the executable from the menu, toolbars, keyboard, and other objects. Descriptions of them all can be found in the Eclipse documentation. These work from the project object in the "C/C++ Projects" panel:

8. Right click the project panel and select "Build Project". A popup and the Console tab will show the build status. If there are errors they will show up in the "Problems " panel.

9. Right click the project panel and select "Run As" > "Run Local C/C++ Application". The Console tab will show your program's output. The "Debug" panel will show the exit status, or the state of the program if it failed to terminate correctly.

Related Docs