• No results found

Running Eclipse C++

N/A
N/A
Protected

Academic year: 2020

Share "Running Eclipse C++"

Copied!
13
0
0

Loading.... (view fulltext now)

Full text

(1)

Running Eclipse C++

Section 1 Create a New Empty project:

Short Instructions:

o File—New—C++ Project [Give a name to the Project] o Click on Empty Project

o Click on Cygwin GCC o Click on Finish

Detailed Instructions for creating the New Empty Project

1.

Step 1: Create a C++ project

1.1. Run Eclipse C++ by double clicking on the eclipse icon on the PC desktop

(2)
(3)

1.3. The C++ Project Wizard opens.

 In the Project name field, type in a name for the project, for example Helloworld.  In the Project type field, select Empty Project under Executable folder.

 In the Toolchain field, select a set of tools (compiler, linker, assembler or debugger) to build the project. You may have more than one toolchain depending on what is installed on your system. However, in the example below “Installing Eclipse C++ for Window and Linux”, only Cygwin GCC was installed.

(4)

1.4. Click Finish. A project is created with default settings and a full set of configurations based on the project type and the toolchain you selected.

Section 2 Create a Source File:

Short Instructions

o File—New—Source File

o Give the name of the Source Folder which is the project name you created in previous step. o Give a name to the Source File. It must end with .cpp (notice the period before the c) o Paste the source Program

o Save

(5)

Detailed Instructions:

2.

Step 2: Create a Source File

2.1. Select File  New  Source File

 A pop up window open. In the Source file field, type the name of your new source file, for example hello.cpp.

Click Finish.

2.2. Type the following Sample code into the blank editor; if you are testing and practicing. You can type or paste your own code if you are working on your own program.

#include <iostream> using namespace std;

int main() {

cout << “My name is xxxxxx” << endl; // prints My name is xxxxxxx cout << “My TxState ID is xxxxx” << endl; // prints My TxState ID is xxxxx

(6)

Note: Replace xxxx xxxxxx with your name and your ID

2.3. Select File  Save (or Ctrl + S which means both keys must be pressed simultaneously).

Section 3 Build a Project:

Short Instructions

o Build [Hammer in the tool bar]…. Connect all the collected pieces.

Note that this icon is set to debug by default so there is nothing else to do with this. o Correct errors pointed out by the Builder

Detailed Instructions

3.

Step 3: Build a Project

3.1. Select Project  Build Project

Or select project from the Project Explorer tab. Right click and choose Build Project

(7)

3.2. If the project builds successfully, the following message will be displayed in the Console view. **** Build of configuration Debug for project helloworld ****

make all

Building file: ../hello.cpp Invoking: Cygwin C++ Compiler

g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"hello.d" -MT"hello.d" -o "hello.o" "../hello.cpp"

Finished building: ../hello.cpp

Building target: helloworld.exe Invoking: Cygwin C++ Linker

g++ -o "helloworld.exe" ./hello.o Finished building target: helloworld.exe

**** Build Finished ****

Note: If the project builds unsuccessfully, error or warning messages will be displayed in the Console view. Correct the errors.

(8)

Section 4 Run the Application

Short Instructions:

o Run [right pointing green arrow on the tool bar] o Output will be on the console section at the bottom

Detailed Instructions

4.

Step 4: Run the application

4.1. In the Project Explorer tab, right click on the title of project name and select Run As  Local C/C++ Application.

(9)

1.1. The output of the application will be displayed in the Console view.

SECTION 5: Print Source Code

5.

Print Source Codes

5.1. Click on the Editor (hello.cpp) – Also called the C++ Perspective or source code window 5.2. Select File  Print

5.3. Next be sure to select the lab printer which should begin its name as cs_derr325****.

Note that the Print option will be grayed out if any of the other window panes are selected / active.

Section 6: Capture and print Screen Output

6.

Print screen output

(10)

6.3. Take a screen shot of the Console view by pressing Ctrl + Alt + PrintScreen / SysRq (again pressing all three keys at the same time).

6.4. Open MS WordPad / MS Word / MS Paint – find this under the start icon (bottom left icon on your desktop) by typing in the program name in the search files and programs field located at the bottom of the window.

6.5. Right click and select Paste

(11)

Section 7: Saving Source Files

7.1 Go to your work space following the path shown below:

o C Drive o Users o Your Net ID o Work Space

7.2 Double Click on the Project Name (to show all the associated files)

7.3 Right Click on the source File – the one listed as a CPP type (the .cpp extension is not shown as part of the actual file name.

7.4 Click on EDIT—it will show your source file

7.5 Save the source File on your Flash Drive (it will be displayed after clicking on the Computer selection in the start window).

Section 8: File Transfer from Flash Drive to your work space

8.1 Open your Flash Drive where your source file is residing

8.2 Run Eclipse C++. If it is a new project, create an empty project

8.3 Access your workspace and drag and drop your source file into your project

8.4 Go back to Eclipse C++ and refresh.

8.5 you will have your source file. Build and Run.

Section 9: Save and Store Files Using SSH (Secure Shell)

9.1 Click on the SSH Secure Shell Client icon. If you don’t have SSH Secure Shell Client, you can download it free at:

http://downloads.cs.txstate.edu/os/windows/remote_access/SSHSecureShellClient-3.2.9.exe

(12)

9.3 In the Host Name field, type any one of these host names:

 athena.cs.txstate.edu  zeus.cs.txstate.edu  eros.cs.txstate.edu  hercules.cs.txstate.edu

9.4 In the User Name field, type your CS Linux username.

9.5 Click Connect.

9.6 Type in your CS Linux password.

(13)

9.8 The left pane is your local machine. The right pane is the remote host. If you want, you can create a new directory to save your file.

9.9 Right click on the remote host pane and select New Folder.

9.10 Type the name of your new folder.

9.11 To upload files from your local machine to a remote host or download files from a remote host to your local machine, follow these steps:

 Navigate to the files you want to download or upload.

 Once you have located file(s) you want to download or upload, select them by clicking once on the file name. To select multiple files, hold down the Ctrl key and using your mouse click on each of the files.

 Once you have selected the files you want to download or upload, you may simply drag them: o from right hand pane to left hand pane and drop them into the desired directory to

download

o from left hand pane to right hand pane and drop them into the desired directory to upload

References

Related documents

No portion of this text may be reproduced by any means without permission in writing from the copyright owner.. Go to http://www.usccb.org/nab/permissions/shtml

The proceeds of sale due to each participant will be his or her proportionate share of the total proceeds realised from the sale through the plan of SATRIX securities on that

Chapters 2 and 3 provide an overview of the major concepts and features of the C++ program- ming language and its standard library.. Their purpose is to motivate you to spend time

Producer Offtaker/ Borrower End-Buyer Prepayment Goods Purchase Price Repayment Prepayment Financing Lender Goods Loan Export Contract.. Toller Off-taker/ Borrower

Android application structure Jni C/C++ application source code Control the C++ build process. Android.mk and Application.mk Written with Makefile syntax Libs

Mandatory Participation in an Industry-wide Pension Fund Act (Wet Bpf 2000) Under the 2000 Mandatory Participation in an Industry-wide Pension Fund Act, when social partners make

Zimmerman finds, for the case of US firms, that for exporting firms there is a positive effect of imports on product innovation, but there is a negative effect for non

In 2011, the hi2 Community Development Workgroup and Product Effectiveness Team created a virtual workforce data call that captured baseline demographic information and