0% found this document useful (0 votes)
91 views

Outline: COMP-111 Programming I COMP-113 Programming II

Creating a C++ Project (Cont.)! Give your project a name: FirstProject Select Executable and Hello World C++ Project Click Next your name your copyright anything for greeting Do NOT change the source click Next. If you get an error message that there are no launch projects then just select the Project Folder in The Project Explorer view and then run it again.

Uploaded by

wildestbee
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views

Outline: COMP-111 Programming I COMP-113 Programming II

Creating a C++ Project (Cont.)! Give your project a name: FirstProject Select Executable and Hello World C++ Project Click Next your name your copyright anything for greeting Do NOT change the source click Next. If you get an error message that there are no launch projects then just select the Project Folder in The Project Explorer view and then run it again.

Uploaded by

wildestbee
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Outline

!  Creating a C++ Project


!  Create Project
!  Build the Project
!  Run the Project
!  Browse the Project Folder
!  Importing a Project
!  Advanced Settings
COMP-111 Programming I !  Add Line Number
COMP-113 Programming II !  Add Source Files
!  Define a Run Configuration
Eclipse Tutorial !  Setting Command Line Arguments

2 Copyright © 2010 Harald Gjermundrød

Creating a C++ Project Creating a C++ Project (Cont.)


!  First you go to: File -> New -> Other… !  Select C++ Project
!  Click Next

3 Copyright © 2010 Harald Gjermundrød 4 Copyright © 2010 Harald Gjermundrød


Creating a C++ Project (Cont.) Creating a C++ Project (Cont.)
!  Give your project a !  Fill in:
name: FirstProject !  Your name
!  Select Executable !  Your copyright
and Hello World C++ !  Anything for
Project greeting
!  Click Next !  Do NOT change the
source
!  Click Finish

5 Copyright © 2010 Harald Gjermundrød 6 Copyright © 2010 Harald Gjermundrød

Creating a C++ Project (Cont.) Creating a C++ Project (Cont.)


!  If you get the following screen. Check the Remember !  Your workspace should look like the one below
my decision and click Yes

7 Copyright © 2010 Harald Gjermundrød 8 Copyright © 2010 Harald Gjermundrød


Build the Project Run the Project
!  Select: Project -> Build All (You can also click the hammer icon) !  To run you can click the green Run button
!  Or select: Run -> Run

(NOTE: If you get an error message that there are no launch


projects, then just select the Project folder in the Project
!  In the Consol view at the bottom hopefully there are no Explorer view and then Run it again
errors in your program

9 Copyright © 2010 Harald Gjermundrød 10 Copyright © 2010 Harald Gjermundrød

Run the Project (Cont.) Browse the Project Folder


!  The output of your run !  The Project Explorer contains
will appear in the Console !  All your Projects
View !  Each project contains
!  Binaries folder
!  This is the executable produced
!  You can copy this file and run it without
the eclipse environment
!  Includes
!  Don’t do anything here
!  Src
!  All the source files for this project
!  You can add more files here
!  Debug
!  Don’t do anything here

11 Copyright © 2010 Harald Gjermundrød 12 Copyright © 2010 Harald Gjermundrød


Importing a Project Importing a Project (Cont.)
!  If you want to move your project from one computer to !  Select: General -> Existing
another following is the steps. Project into Workspace
!  1) From the source computer copy the folder that contains !  Click: Next
your projects, normally the folder is call workspace.
!  2) In the destination computer do the
following.
!  Click on: File -> Import…

13 Copyright © 2010 Harald Gjermundrød 14 Copyright © 2010 Harald Gjermundrød

Importing a Project (Cont.) Outline


!  Click on Browse and find the !  Creating a C++ Project
directory where you saved !  Create Project
your projects. !  Build the Project
!  If only one project exists in !  Run the Project
that directory it is !  Browse the Project Folder
automatically selected !  Importing a Project
!  Click: Finish !  Advanced Settings
!  Add Line Number
!  Add Source Files
!  Define a Run Configuration
!  Setting Command Line Arguments

15 Copyright © 2010 Harald Gjermundrød 16 Copyright © 2010 Harald Gjermundrød


Add Line Number Add Source Files
!  To add line numbers in the margin of the editor do the !  Right-click on the Project folder and select: New -> Source File
following:
!  Select: Window -> Preferences
!  Click (Expand) on: General-> Editors -> Text Editors
!  Select: Show line numbers

17 Copyright © 2010 Harald Gjermundrød 18 Copyright © 2010 Harald Gjermundrød

Add Source Files (Cont.) Define a Run Configuration


!  Give your file a name, with the cpp extension !  Your project may have multiple configurations, so that you
!  Click Finish can run your project with different settings
!  Select: Run -> Run Configurations…

19 Copyright © 2010 Harald Gjermundrød 20 Copyright © 2010 Harald Gjermundrød


Define a Run Configuration (Cont.) Define a Run Configuration (Cont.)
!  In the dialog you select C/C++ Local Application !  You are presented with the dialog below
!  Then you click on the New icon !  You can give your configuration a new name if you want

21 Copyright © 2010 Harald Gjermundrød 22 Copyright © 2010 Harald Gjermundrød

Define a Run Configuration (Cont.) Define a Run Configuration (Cont.)


!  When you click on the Browse button next to the Project: !  When you click on the Browse button next to the C/C++
textbox, the dialog below appears Application: textbox, the dialog below appears
!  Select the name of your project and click OK !  Select the name of your
executable from your
project and click OK

23 Copyright © 2010 Harald Gjermundrød 24 Copyright © 2010 Harald Gjermundrød


Define a Run Configuration (Cont.) Setting Command Line Arguments
!  You should now have the screen below !  If your application takes command line arguments, you set
!  You click the Apply button these in your Run Configuration
!  To run, you !  For instance if you modify your hello world program to the
click Run following
button
!  To close you
click the Close
button

25 Copyright © 2010 Harald Gjermundrød 26 Copyright © 2010 Harald Gjermundrød

Setting Command Line Arguments (Cont.) Setting Command Line Arguments (Cont.)
!  After you have modified your source you have to select Build !  You need to modify the run configuration: Run -> Run
All or Build Project Configurations…

27 Copyright © 2010 Harald Gjermundrød 28 Copyright © 2010 Harald Gjermundrød


Setting Command Line Arguments (Cont.) Running the Application
!  Select your Run Configuration under the C/C++ Local !  Run the program again
Applications and the arguments are
!  Select the (x) passed to the main
=Arguments tab function
in the dialog !  You will see the output
!  Enter the in the Console View
Program
arguments:
!  Click Apply

29 Copyright © 2010 Harald Gjermundrød 30 Copyright © 2010 Harald Gjermundrød

You might also like