Setting up Eclipse Computer Organization I 1 CS@VT August 2009 ©2009 McQuain Getting Eclipse for...

Post on 16-Jan-2016

220 views 0 download

Transcript of Setting up Eclipse Computer Organization I 1 CS@VT August 2009 ©2009 McQuain Getting Eclipse for...

Setting up Eclipse

Computer Organization I

1

CS@VT August 2009 ©2009 McQuain

Getting Eclipse for C/C++ Development

Go to www.eclipse.org and click on Download Eclipse:

Select the Eclipse IDE for C/C++ development:

Download the distribution:

Unzip the distribution in an appropriate location. If you’ve already got Eclipse for Java installed, I recommend placing this in a different directory tree, say eclipsecpp.

Setting up Eclipse

Computer Organization I

2

CS@VT August 2009 ©2009 McQuain

Creating a C Project for Cygwin

Start Eclipse

Setting up Eclipse

Computer Organization I

3

CS@VT August 2009 ©2009 McQuain

Creating a C Project for Cygwin

Start Eclipse and select File/New/C Project:

Setting up Eclipse

Computer Organization I

4

CS@VT August 2009 ©2009 McQuain

Creating a C Project for Cygwin

Enter a name for your Eclipse project…

choose a location for it if you like…

and select Empty Project.

Click on Next…

Setting up Eclipse

Computer Organization I

5

CS@VT August 2009 ©2009 McQuain

Creating a C Project for Cygwin

Click on Advanced settings…

Setting up Eclipse

Computer Organization I

6

CS@VT August 2009 ©2009 McQuain

Configuring the C Project

Expand the C/C++ Build tree, select Settings, and select Cygwin C Compiler…

In the Command text box, enter gcc-4 as shown…

Setting up Eclipse

Computer Organization I

7

CS@VT August 2009 ©2009 McQuain

Configuring the C Project

Select Miscellaneous and edit the Other flags box to include –std=c99:

Setting up Eclipse

Computer Organization I

8

CS@VT August 2009 ©2009 McQuain

Configuring the C Project

Select Cygwin C Linker… in the Command text box, enter gcc-4 as shown…

Click OK… and then Finish…

Setting up Eclipse

Computer Organization I

9

CS@VT August 2009 ©2009 McQuain

Adding a C Source File

The Eclipse project has been created… now it’s time to add a source file:

Setting up Eclipse

Computer Organization I

10

CS@VT August 2009 ©2009 McQuain

Adding a C Source File

Choose a name the source file:

You can leave the Template setting alone, or experiment with it as you like…

Setting up Eclipse

Computer Organization I

11

CS@VT August 2009 ©2009 McQuain

Adding a C Source File

Now you’ve got a nearly-empty source file:

Setting up Eclipse

Computer Organization I

12

CS@VT August 2009 ©2009 McQuain

Editing the Source File

Add the source code as shown below:

Setting up Eclipse

Computer Organization I

13

CS@VT August 2009 ©2009 McQuain

Performing a Build

Use the Project menu or click on the build button (the hammer icon):

Setting up Eclipse

Computer Organization I

14

CS@VT August 2009 ©2009 McQuain

Checking the Build Results

Select the Console window and view the results of the build:

The given source code was designed to test whether you’ve configured the project properly. If not, the build will fail, since it requires compatibility with the C99 Standard.