Dept. Info
Faculty
Programming Contests
Students
Alumni
Workshops

Facilities

 

Programming Competition
 

Instructions for C++ using Eclipse

Starting this year (2005) we will be using the Eclipse environment for both C++ and Java development during the contest. 

Prior to these instructions it will be necessary to obtain and install Eclipse, the C++ plugin for Eclipse (called CDT), and Cygwin (the Windows version of the gnu C++ compiler and debugger).  Go here for instructions for these installations.

The instructions below are written assuming the projects are set up as they will be during the competition.  Download the workspace below.  This provides you with a workspace with two projects: Problem0 and Problem99.  These are projects for the two sample problems. 

Download the workspace.  (This provides a zip file.  You can extract the zip file to any location.  However, when you start Eclipse you will want to point Eclipse to the extracted folder named workspace.)

Sample Problem 0 - Kindergarten Counting

Sample Problem 99 - Sitting by the Dock of the (Loading) Bay


Configuring Eclipse for C++ and the Sample Projects

Start Eclipse.

Open a C/C++ Perspective by clicking Window / Open Perspective / C/C++
Close the Welcome to Eclipse panel on the right.  This should provide you with four views: a C/C++ Projects view in the left panel, an empty view in the center panel (this will be the editor window), a Make Targets view in the right panel, and a Console view on the bottom of the screen.  If any of these views are missing you can go to Window / Open View to open them.

Import the projects.  Click on File / Import . . . / Existing Project into Workspace /  then browse to locate the project within the workspace folder you extracted from the zip file, and click Finish.  Do this for both projects.
 

Creating/Editing/Running C++ programs in Eclipse (using CDT) 

The Eclipse environment has been constructed with pre-built projects for the programming contest.  There will be a pre-built project for each problem in the contest.  In each project will be the files needed including a source file that is a nearly empty shell which you will complete with your solution.

Four panels will be visible in the Eclipse environment:

1) On the left will be a panel titled C/C++ Projects
         
They are named Problem1, Problem2, etc.

2) In the middle of the screen is an Editor window.
          This is where files appear that you work on in the course of your programming.

3) On the right will be a panel titled Make Targets.
          This panel lists eight icons - one for each problem.
          They are named Problem1, Problem2, etc.
          This is where you will build a project which will compile the program and create the executable.

4) At the bottom of the screen is a Console window.
          This is where you will find build messages including any error messages from the compiler.

If you examine the contents of each project folder in the Projects panel on the left you will see the AP classes: apstring.h, apstring.cpp, apmatrix.h, apqueue.h, apstack.h, and apvector.h.  You will also see a source file named problemx.cpp, where x is the problem number.  This is the file you should modify to add the code you write to solve this problem. 

Open the source file problemx.cpp by double-clicking the file name in the Projects panel.  Once you have modified the code be sure to save your changes before building (or rebuilding) the project.

Note: do not open or modify any other files.

After writing the solution to a problem SAVE THE SOURCE CODE.  Before you run the program you must build the project. 

To build the project click on the “all” under the appropriate problem icon in the Make Targets panel on the right.  After building the project you will see messages appear in the Console window.  If there are no compiler errors you should find an executable file (named problemx.exe) listed under the project name in the Projects panel.

To run the program you need to double-click the executable file.

When you run a program a DOS window will appear which serves as the console during program execution.  At the end of every program is a request for a character.  This keeps the DOS window open until dismissed by the user.  Enter any letter to close the window.

 

© Copyright St. Bonaventure University 2003 All Rights Reserved