Laboratory Assignment #3 Eclipse CDT

Similar documents
Laboratory Assignment #4 Debugging in Eclipse CDT 1

Eclipse CDT Tutorial. Eclipse CDT Homepage: Tutorial written by: James D Aniello

Using Eclipse for C, MPI, and Suzaku

Eclipse Setup. Opening Eclipse. Setting Up Eclipse for CS15

Module 3: Working with C/C++

TNM093 Practical Data Visualization and Virtual Reality Laboratory Platform

In this lab, you will build and execute a simple message flow. A message flow is like a program but is developed using a visual paradigm.

Module 4: Working with MPI

Using Eclipse for Java. Using Eclipse for Java 1 / 1

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

ECM583 Special Topics in Computer Systems

Building and Running a Simple UML RT Model in RSARTE

DS-5 ARM. Using Eclipse. Version Copyright ARM. All rights reserved. ARM DUI 0480L (ID100912)

Creating a new CDC policy using the Database Administration Console

HOW TO USE CODE::BLOCKS IDE FOR COMPUTER PROGRAMMING LABORATORY SESSIONS

VikiLABS. July 8, 2017

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

INF 111 / CSE 121. Homework 3: Code Reading

UNic Eclipse Mini Tutorial (Updated 06/09/2012) Prepared by Harald Gjermundrod

A Linux Virtual Machine for CS-2011 Projects

Getting Started with Eclipse/Java

David Scuse Department of Computer Science University of Manitoba. Eclipse 3.1

CS 261 Recitation 1 Compiling C on UNIX

Introduction. Key features and lab exercises to familiarize new users to the Visual environment

Introducing HP NonStop Development Environment Version 2.0 for Eclipse (NSDEE 2.0)

Using the GCC toolchain for Mulle SW development.

At the shell prompt, enter idlde

1) Log on to the computer using your PU net ID and password.

POOSL IDE Installation Manual

ECE2049 Embedded Computing in Engineering Design. Lab #0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

Lab 1: Introduction to C, ASCII ART & the Linux Command Line

SDKs - Eclipse. SENG 403, Tutorial 2

Code::Blocks Student Manual

Tool Setup. Code Composer Studio

Prerequisites for Eclipse

ARM DS-5. Eclipse for DS-5 User Guide. Version 5. Copyright ARM. All rights reserved. ARM DUI0480Q

Labs instructions for Enabling BeagleBone with TI SDK 5.x

Engr 123 Spring 2018 Notes on Visual Studio

Laboratory 1: Eclipse and Karel the Robot

BASICS OF THE RENESAS SYNERGY PLATFORM

i2b2 Workbench Developer s Guide: Eclipse Neon & i2b2 Source Code

Migrating from CubeSuite+ to Eclipse RL78 Family

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang

Introduction to Computation and Problem Solving

Scientific Software Development with Eclipse

What s NetBeans? Like Eclipse:

Contents. Anaplan Connector for MuleSoft

What s new in CDT 4.0 and beyond. Doug Schaefer QNX Software Systems CDT Project Lead

Installing Eclipse CDT and MinGW

Eclipse Environment Setup

2 Getting Started. Getting Started (v1.8.6) 3/5/2007

Code::Blocks Student Manual

MEDIA COMPUTATION DRJAVA. Lecture 11.3 November 7, 2008

ECE QNX Real-time Lab

NSIGHT ECLIPSE EDITION

egui Eclipse User Guide

GNATbench for Eclipse User s Guide

DS-5 ARM. Getting Started with DS-5. Version 5.6. Copyright 2010, 2011 ARM. All rights reserved. ARM DUI 0478F (ID071411)

S D K Q U I C K S T A R T

6L00IA - Introduction to Synergy Software Package Short Version (SSP v1.2.0) Renesas Synergy Family - S7 Series

CS Lab 1 Linux/Shell Basic commands Introduction. Teaching Assistant Henrique Potter

NSIGHT ECLIPSE EDITION

CSCI 201 Lab 1 Environment Setup

AN 834: Developing for the Intel HLS Compiler with an IDE

ARM DS-5. Eclipse for DS-5 User Guide. Version 5. Copyright ARM Limited or its affiliates. All rights reserved.

μc/probe on the element14 BeagleBone Black

IDE: Integrated Development Environment

Configuring Ubuntu to Code for the OmniFlash or OmniEP

1.00 Lecture 2. What s an IDE?

News in RSA-RTE 10.2 updated for sprint Mattias Mohlin, January 2018

Programming Assignment #4 Arrays and Pointers

Manual Eclipse CDT Mac OS Snow Leopard

CSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java)

Parallel Programming Pre-Assignment. Setting up the Software Environment

Parallel Programming Pre-Assignment. Setting up the Software Environment

Getting Started with Eclipse for Java

3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS)

Your password is: firstpw

News in RSA-RTE 10.1 updated for sprint Mattias Mohlin, November 2017

Integrating Open Source Tools for Developing Embedded Linux Applications

CMPT 300. Operating Systems. Brief Intro to UNIX and C

User Guide. Introduction. Requirements. Installing and Configuring. C Interface for NI myrio

Migration from HEW to e 2 studio Development Tools > IDEs

Lab 1: First Steps in C++ - Eclipse

IMPLEMENTING SCL PROGRAMS. Using Codeblocks

NonStop Development Environment for Eclipse 4.0 Debugging Supplement

Getting Started (1.8.7) 9/2/2009

Using the Zoo Workstations

ECSE-323 Digital System Design. Lab #1 Using the Altera Quartus II Software Fall 2008

APPLICATION COMMON OPERATING ENVIRONMENT (APPCOE)

LinuxScope-JTD Installation Guide. Version 4.0.0

CS 201 Software Development Methods Spring Tutorial #1. Eclipse

Project 0: Linux & Virtual Machine Dabbling

Eclipse Plug-in for AccuRev User s Guide Version April 2012

You re most likely eager to get started programming in C. I shan t waste

News in RSA-RTE 10.1 updated for sprint Mattias Mohlin, March 2017

OMNeT++ IDE Developers Guide. Version 5.2

News in RSA-RTE 10.2 updated for sprint Mattias Mohlin, May 2018

Our second exam is Thursday, November 10. Note that it will not be possible to get all the homework submissions graded before the exam.

Introduction to C++: Part 1 tutorial version 0.2. Brian Gregor Research Computing Services

Transcription:

Lab 3 September 12, 2010 CS-2303, System Programming Concepts, A-term 2012 Objective Laboratory Assignment #3 Eclipse CDT Due: at 11:59 pm on the day of your lab session To learn to learn to use the Eclipse C/C++ Development Toolkit. Introduction An Integrated Development Environment (IDE) is a software application (or set of software applications) to provide a coordinated set of editors, compilers, debuggers, and other tools for software development, both for individual programmers but more importantly for teams and large organizations. IDE s have been around for many years and have grown in features and functionality. Eclipse began in around 2000 as an IBM project to compete with Microsoft s Visual Studio. It has since grown into an open-source system capable of support a wide variety of languages and tools via plug-ins. Some students are already familiar with Eclipse for development of Java programs. Eclipse CDT is a configuration of Eclipse that has the plug-in for C and C++ development already installed. Eclipse CDT is installed on the WPI CCC Linux systems and on the Windows workstations in most of the WPI public computer laboratories. It is freely downloadable to your Windows, Macintosh, or Linux personal computer or laptop. In this Laboratory Assignment, you will learn how to import a simple C programming project into Eclipse, build it, and get it running. In subsequent assignments, we will learn how to take advantage of other tools in Eclipse CDT. Getting Started Sign the attendance sheet. Create a directory to hold the files for Lab 3. Download and unzip the same zip file that you used for Lab 2, namely from the following URL: http://web.cs.wpi.edu/~cs2303/a12/common/lab2files.zip Your directory should now contain the four files intarray.c, intarray.h, sinewave.c, and makefile. Start the version of Eclipse named Eclipse x86. This can be found in the Start Menu under Start Menu All Programs Eclipse Eclipse x86 If you have never used Eclipse before, it may ask you where you want to keep your Workspace. Your workspace is a directory where Eclipse stores files and information regarding your various Eclipse pro- 1

jects. A convenient place is in your home (i.e., FILER) directory. If you already have an Eclipse workspace, you may simply add the projects of this lab to it. Once Eclipse finishes loading, you should switch to the CDT perspective by doing the following: Open the Window menu, hover over Open Perspective, and click Other. Select C/C++ from the list and click OK. In the C/C++ perspective, you can create a new C Project. To create the new project: Open the File menu, hover over New, and click C Project. In the window that appears, you should enter a name for your project (for example, Sinewave) and select the Empty Project type under the Makefile project category. Once you select the project type, you will be able to select the MinGW GCC toolchain from the list box on the right. Click Finish to create the new project. Next, you need to make changes to the Project configuration so that the project will build on the WPI public laboratory computers. 1 You may need to alter this configuration if you bring the Project back to your personal computer. Right-click on the project in Project Explorer and click Properties. Open the C/C++ Build section and click Environment. Select the PATH variable and click the Edit button. Click in the Value field and place the cursor at the beginning of the line. Note: It is important that you do not change the existing value of the PATH variable, you simply want to append the following. Copy and paste the following path, including the ending semicolon: C:\cccapps\MinGW\msys\1.0\bin; Click OK to close the Edit variable window and click OK again to save your changes to the project configuration. Populating and Building the Project Open the directory where you extracted the files in Windows Explorer. Hold the CTRL key and click on each of the files you want to import: intarray.c, intarray.h, makefile, and sinewave.c. Once you have selected the files, drag them into the Eclipse window and release them over your project folder in the Project Explorer. Select the option to copy the files and click OK. Copies of the files should now be included in your project within your workspace. To build/compile your project you need to edit the makefile to include an all target. This is because when Eclipse runs make, it invokes the command make all. Add the following line above the sinewave target: all: sinewave To ensure that the clean command does what you expect, you should also add *.exe to the arguments of the rm command under the clean target. Save the changes to your makefile. 1 These changes up through the path C:\cccapps\MinGW\msys\1.0\bin are due to the configuration of the software on the WPI laboratory computers. If you install Eclipse CDT and MinGW on your own Windows systems as instructed below, the change to the path environment variable may not be necessary. 2

To build the project, Right-click on the Project in Project Explorer Click Build Project Alternatively, you can select Build Project or Build All under the Project menu. If you open the Console tab at the bottom of the Eclipse perspective (i.e., window), you should see that your project compiled successfully. To run the project, Right-click on the Project in Project Explorer and hover over Run As Click Local C/C++ Application, select the MinGW gdb option, and click OK. Assuming everything went well, your program should have run and you should see the output of the sinewave program on the Console tab. You can expand the Console window by double clicking on the tab itself. The row of four tabs in the bottom panel of the Eclipse window will expand to fill the entire window. Double click again on the tab, and those four tabs will shrink back to their original size. Exporting your Project To submit your project or to easily transfer it to another computer, you should export the project as a zip archive from Eclipse. To do this, Clean the project first. Do this before anything else, so that you don t submit a lot of temporary and/or object files. Right click on the project name in the Project Explorer and select Clean Project. Alternatively, select Clean from the Project menu. Right-click on the Project and click Export. Under the General category, choose the Archive File option and click Next. Click Browse and choose where you would like to save the project archive. Click Finish to export the Project. You should now have a zip file suitable for submitting to Turnin or for porting to another environment. If you open the zip file, you should find copies of the three original source files, your modified makefile, plus several other files and/or folders with names that begin with a dot. These are Eclipse s configuration files for this project. To run the program another platform without Eclipse, unzip the archive file and run the make command to build on that platform. You can then run the program there. The graders will be using this method when grading your projects during the rest of this course. Submit your archive file to the web-based Turnin system at https://turnin.cs.wpi.edu:8088/ This project is Lab 3. Be sure to complete this step before midnight on the day of the lab session. Providing input and arguments to your program Most programs need some sort of input or some arguments on the command line. These can be provided in the project properties. Right-click on the project name and select Properties. Select Run/Debug settings in the left panel, and select the name of the executable file in the middle panel, and click the Edit button on the right. This should bring up a dialog resembling the following: 3

Click the Arguments tab and enter the arguments, file redirections, and pipes exactly as you would have entered them from a command shell. Do not, however, include the name of the program, because that will be provided by Eclipse. For example, the Professor s version of the Game of Life assignment has the following text in the Program Arguments box: <./LifeTextFile.txt If you have time in this Lab, import your Game Of Life project following these steps. Show it running in an Eclipse console window. Editing In the Sinewave project the Project Explorer, double click on the file sinewave.c. This brings up the Eclipse program editor. It is well-adapted to editing C and C++ programs. For example, select the variable i in the first declaration under main. Notice that all other instances of i are automatically highlighted so that you can see where it is used. Next, hover over the call to histogram() at the end of main(). Eclipse brings up a popup box showing the first few lines of code of the histogram function as it is declared in another.c file. Next, add a printf statement to main after the call to histogram. Notice that after you type the opening parenthesis, the closing parenthesis is automatically added and the cursor is positioned between the two. Likewise, when you type the double quote mark for the format string, a closing double quote is 4

automatically added, and the cursor is again positioned between the two. Similar support is provided for square brackets and curly brackets. The editor also provides automatic indentation of C and C++ programs according to generally accepted coding conventions. This makes for more readable programs. Play around with the program editor to learn more about what it can do. There are many other tricks documented under the C/C++ Development Guide that can be found under the Help > Help Contents menu. Using Eclipse on Linux Eclipse CDT is installed on the WPI Linux systems. It is easily accessible from PuTTY or your SSH client, provided that you have an X-window server running on your own computer. In a command shell, type eclipse & This will bring up Eclipse in a new window on your desktop. Everything works the same as the version on Windows or Macintosh personal computers, but the compilation is done by the GNU gcc compiler and debugging tools. While this works well functionally, it is not nearly so responsive as Eclipse running locally on your own or a public computer. 5