What is Eclipse Integrated Development Environment IDE Eclipse Tutorial A Universal Platform for Development Tools Open extensible architecture based on plug ins Open source Multi platform multi language multi vendor Endorsed by major tool vendors Reduced Complexity through customizable perspectives and views Support for popular features through open standards see the Eclipse Project at Eclipse org Plug in development environment PDE C development tools CDT Eclipse Platform Platform Standard Java2 Virtual Machine Java VM 2 Tutorial How to get started See the tutorial at http cs saddlback edu Eclipse Resources Creating a C Project Go to File New C Project Click on File C Project New Close the Welcome to get to the c eclipse platform Click on the x 3 4 Creating a C Source File 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 Finish Go to File New Source File File New Give it a Project Name For now use L5 Eclipse Lab Source File Make sure this is checked MinGW GCC Empty Project Click on the Next to Executable Make sure this is checked 5 6 1 Creating a source file TYPE the code on the next slide into the main cpp window Make sure you hit return enter after the DO NOT CUT PASTE Enter main cpp in the name finish Main cpp Make sure this matches your project name Delete the default text Type in main cpp Your source file Has to end with cpp stands for c plus plus 7 Displaying Line Numbers and Print Margins Line numbers help with debugging Margins make sure your code doesn t word wrap Line numbers should be displayed for all programs and output in this class Expand these Set it to 75 Left click to check Show Print Margin Change this to 75 Left click to check Show line numbers Right Click Here On the left gray margin of your main cpp Select Preferences Click OK 9 A UT HO R S TU DE NT I D L AB 0 Ec li ps e La b C LA SS S EC TI ON D UE D AT E i nc lu de io st re am i nc lu de io ma ni p us in g na me sp ac e st d Fill in this author box with YOUR appropriate Information ie name lab lab name class section due date The means you need to save DO NOT ALTER THE TEXT IN THIS SECTION the green text Replace the info in this section with YOUR info your name class section and the lab name all within quotes plus the proper lab re tu rn 0 you hit the enter key after the You 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 in O UT PUT Cl as s Hea di ng co ut l ef t co ut co ut n PR OG RAM ME D B Y PRO GR AM MER co ut n se tw 14 C LA SS C LA SS co ut n se tw 14 S EC TIO N S ECT IO N co ut n LA B se tw 9 LAB N UM LAB N AME co ut n n n co ut r ig ht MAKE SURE Make sure you save before every build Save Type this program in EXACTLY as you see it here EXCEPT the changes specified by the purple boxes D oc um en ta ti on t ha t go es h e re w il l be d is cu ss ed l at er in t ma in C ON STA NT S U SE D F OR CL AS S HEA DI NG AL L W IL L B E OU TPU T P RO GRA MM ER Pr ogr am mer s N ame C LA SS St ude nt s Co ur se S EC TIO N Cl ass D ays a nd Ti me s L AB NU M La b N um ber sp eci fi c t o th is la b L AB NA ME Ti tle o f t he L ab co ns t cha r PRO GR AM MER 3 0 M ich el e R ou ss eau co ns t cha r CLA SS 5 C S1A co ns t cha r SEC TI ON 25 M W 7 30a 1 2 0 0p co ns t int LAB N UM 5 co ns t cha r LAB N AM E 1 7 E cli ps e T ut or ial 10 11 13 2 Building a C Project Compiling your code You can reduce the window here 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 first No means it has been saved Change these to includeyour name the correct date your student id class section and the correct Lab Project Build Project Remember C is case sensitive Note This window must be active Click on it 14 15 Any errors will show up in the console window at the bottom of the perspective Running 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 Application The console Will show if there are any errors Run The Build complete for project line indicates there were no errors Problems will show you the same errors in a different format If you have errors double check that you have not made any typos Errors will be indicated in your code by a red circle with an x in it Check the line above the circle too Make sure you aren t missing any semi colons 16 Run Program Note This window 17 To Print your Output If you have errors you will get a launch failed no binaries Otherwise the results will display in the console window Go back and fix your errors Eclipse won t allow you to print from the console You can print from the editor where main cpp is Console 1 Create a File 2 Copy and Paste the output to the file 3 Print the file Output You can expand this a bit By clicking on the edge and dragging up 18 19 3 1 Create a File con t 1 Create a File 1 Right click on the project folder 2 Select New 3 Left Click File 1 Give it a name e g ScreenIO txt 2 Click on Finish 20 21 Copy and Paste your Screen IO into the File Don t worry your main cpp is still here Print and Exit Print 1 Click on File Select File Print ScreenIO txt Your new file …
View Full Document
Unlocking...