DOC PREVIEW
Saddleback CS 1B - Eclipse Tutorial

This preview shows page 1-2-3-4 out of 11 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1Eclipse TutorialWhat is EclipseIntegrated Development Environment (IDE)● A Universal Platform for Development Tools Open, extensible architecture based on plug-ins Open-source● see the Eclipse Project at Eclipse.org Multi-platform, multi-language, multi-vendor Endorsed by major tool vendors Reduced Complexity through customizable perspectives and views Support for popular features through open standardsStandard Java2 Virtual Machine Eclipse PlatformC++ development toolsJava VMPlatformCDTPDEPlug-in development environment22Tutorial – How to get started See the tutorial at ● http://cs.saddlback.edu  Eclipse Resources Creating a C++ Project Close the Welcome to get to the c++ eclipse platform3Click on the x Go to File  New  C++ Project● Some machines will have C++ project◘ If so skip the next two slides● If not just select project4C++ ProjectClick on FileNew3 Expand Executable from “Project Types” by clicking on the + Select Empty project from “Project Types”  Select MinGW GCC from “Toolchain” Select a Project Name  for this lab type: Eclipse Lab Click Finish5Make sure this is checkedMake sure this is checkedClick on the + Next to ExecutableGive it a Project Name For now use Eclipse LabEmpty ProjectMinGW GCC Creating a C++ Source File6 Go to File  New  Source FileFile NewSource File4Creating a source file Enter main.cpp in the name  finish7Type in main.cppYour source fileHas to end with.cpp (stands for c plus plus)Make sure thismatches your project name Type the code on the next slide into the “main.cpp” window Make sure you hit return/enter after the }8Main.cpp5/*********************************************************** AUTHOR : ** STUDENT ID : ** LAB #0 : Eclipse Lab ** CLASS : ** SECTION : ** DUE DATE : ***********************************************************/#include <iostream>#include <iomanip>using namespace std;int main(){/****************************************************** CONSTANTS* ---------------------------------------------------* PROGRAMMER : Programmer's Name* CLASS : Student's Course* SECTION : Class Days and Times* LAB_NUM : Lab Number (specific to this lab)* LAB_NAME : Title of the Lab*****************************************************/const char PROGRAMMER[30]="Michele Rousseau";const char CLASS[5] = "CS1A";const char SECTION[25] = "MW: 7:30a - 12:00p";const int LAB_NUM = 5;const char LAB_NAME[17] = "Eclipse Tutorial";cout << left;cout << "**************************************************";cout << "\n* PROGRAMMED BY : " << PROGRAMMER;cout << "\n* " << setw(14) << "CLASS" << ": " << CLASS;cout << "\n* " << setw(14) << "SECTION" << ": " << SECTION;cout << "\n* LAB #" << setw(9) << LAB_NUM << ": " << LAB_NAME;cout << "\n**************************************************\n\n";cout << right;return 0;}9Type this program in EXACTLY as you see it hereEXCEPT the changes specified by the purple boxesFill in the header box here with YOURappropriateInformation(ie. name,lab #, class, etc.)Replace my infoin this section with YOURinfo. (your name in quotes,your class and section, and the proper lab #) Make sure you save before every build10You can expand any window by clicking on this icon(on the window you want to expand)--This may make It easier for You to see your code As you type it inSaveThe * means youneed to save611You can reduce the window hereMAKE SUREyou hit the enter key after the }Remember C++ is case sensitiveChange theseTo your name, the correct date, your student id, class & section and the correct Lab #No *meansit hasbeen savedBuilding a C++ Project (Compiling your code) Build compiles your code from C++ to machine language  it makes your code executable by the computer  <ctrl> B to build the project or go to Project  Build All Make sure you save first12Project Build AllNote:This windowmust be active- Click on it -7Any errors will show up in the console window at the bottom of the perspective13The “console” Will show if there areany errors“Problems” willshow you the sameerrors in a differentformatThe “Build complete for project…”line indicates there were no errors.If you have errors  double checkthat you have not made any typos.Errors will be indicated in your codeby a red circle with an x in it.Check the line above the circle too.Make sure you aren’t missing anysemi -colonsRunning a C++ Application If code has compiled properly (You got the build complete message)  You are ready to build First  Click on the source file window● In this case main.cpp Click on Run  Run as  2Local C/C++ Application14Run As2Local C/C++ ApplicationNote:This windowmust be active- Click on it -8Run Program If you have errors  you will get a “launch failed no binaries”● Go back and fix your errors Otherwise the results will display in the console window15ConsoleOutputYou can expand this a bitBy clicking on theedge and dragging upDisplaying Line Numbers and Print Margins Line numbers help with debugging● Line numbers should be displayed for all programs and output in this class Margins make sure your code doesn’t word wrap ● Set it to 7516Select“Preferences”Right Click Here-On the left graymargin of yourmain.cpp917Left click to check “Show Print Margin”Expand theseChange this to 75Left click to check “Show line numbers”Click “OK”To Print your Output Eclipse won’t allow you to print from the console● You can print from the editor (where main.cpp is)1 - Create a File2 - Copy and Paste the output to the file3 – Print the file18101. Create a File19#1 - Right click on theproject folder#2 – Select New#3 – Left Click File1. Create a File (con’t)20#1 - Give it a namee.g. ScreenIO.txt#2 – Click on Finish11Copy and Paste your Screen IO into the File21#1 – Copy your output from herectrl-a to select allctrl-c to copy#2 – Paste your output hereClick herectrl-v to paseScreenIO.txtYour new file willShow up hereDon’t worry yourmain.cpp is still herePrint and Exit Print● Select File -> Print Click on the tab for main.cpp● Select File -> Print To Exit from Eclipse● Select File ->


View Full Document

Saddleback CS 1B - Eclipse Tutorial

Download Eclipse Tutorial
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Eclipse Tutorial and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Eclipse Tutorial 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?