Eclipse Tutorial What is Eclipse Integrated Development Environment IDE 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 Close the Welcome to get to the c eclipse platform Click on the x 3 1 Go to File New C Project Click on File C Project New 4 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 Give it a Project Name For now use L5 Eclipse Lab Make sure this is checked MinGW GCC Empty Project Click on the Next to Executable Make sure this is checked 5 Creating a C Source File Go to File New Source File File New Source File 6 2 Creating a source file Enter main cpp in the name finish Make sure this matches your project name Type in main cpp Your source file Has to end with cpp stands for c plus plus 7 TYPE the code on the next slide into the main cpp window Make sure you hit return enter after the DO NOT CUT PASTE Main cpp Delete the default text 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 Set it to 75 Right Click Here On the left gray margin of your main cpp Select Preferences 9 3 Expand these Left click to check Show Print Margin Change this to 75 Left click to check Show line numbers Click OK 10 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 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 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 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 re tu rn 0 11 you hit the enter key after the Make sure you save before every build Save The means you need to save 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 13 4 You can reduce the window here No means it has been saved Change these to includeyour name the correct date your student id class section and the correct Lab Remember C is case sensitive 14 Building 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 first Project Build Project Note This window must be active Click on it 15 Any errors will show up in the console window at the bottom of the perspective The console Will show if there are any errors 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 5 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 Run Note This window 17 Run Program 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 Console Output You can expand this a bit By clicking on the edge and dragging up 18 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 File 2 Copy and Paste the output to the file 3 Print the file 19 6 1 Create a File 1 Right click on the project folder 2 Select New 3 Left Click File 20 1 Create a File con t 1 Give it a name e g ScreenIO txt 2 Click on Finish 21 Copy and Paste your Screen IO into the File Don t worry your main cpp is still here ScreenIO txt Your new file will Show up here 2 Paste your output …
View Full Document
Unlocking...