Introduction to Eclipse Programming with an Integrated Development




























- Slides: 28
Introduction to Eclipse Programming with an Integrated Development Environment
What’s an Integrated Development Environment? • We need a tool to… – – – Help us write the code Help us test the code Help us debug the code Help us fix the code Help us deploy the code • A tool that does all these things in a single application is an Integrated development Environment (IDE) • We’re going to use Eclipse
Layout of a Java Program Workspace Project Source Folder Source Files
Starting Eclipse • Select Eclipse from Start Menu • Select a folder for your Workspace (to be defined next) – this option may not appear. If not, just use the default – My Documents is safe on class computers
Starting Eclipse
Eclipse Workspace/Project • Create a new C Project – This will create a Workspace the first time through
Eclipse Workspace/Project • Give it a Project name • Select “Empty Project” under Executable • Press “Finish” – This creates a Workspace (1 st time) – Also creates a Project within the Workspace – Subsequent new projects will be added to the existing workspace
Workspace/Project • You may have to close the welcome screen to see this view • Just press the X on the “Welcome” tab
Source Folder • Create a new Source Folder
Source Folder • Give it a name
Source File • Create a Source File
Source File • Give it a name
Workspace/Project • Note that a Workspace can contain 1 or more Projects – You might want to create a project for each class you have – You might want to create a project for each assignment within a class – It’s all up to you • The message here is ORGANIZATION!!! It is critical if you want to be a successful computer scientist!!!
Workspace/Project/Folder/File
Adding Code • Type in the code from page 7 of Kernighan and Ritchie • Save the file (File->Save or ^s)
Build the Project • Build the project – This will run the C compiler and the linker – You will be told of warnings and errors in your program – You must fix errors – You should fix warnings
Running the Program • Run->Run As…
Running the Program • Note the results in the console window
Congratulations • You’ve just created a working C program! • Note that the Eclipse Integrated Development Environment (IDE) is persistent therefore your screens may vary from what you just saw • What does Integrated Development Environment mean? • What does persistent mean?
Transporting a Project (Export out of Eclipse) • File -> Export…
Transporting a Project (Export out of Eclipse) • Select General ->File system • Click Next
Transporting a Project (Export out of Eclipse) • Select src (should be selected) • Browse to a location • Select Finish • This will place the source files (src files) in the selected folder
Transporting a Project (Import into Eclipse) • Create a project like we did previously but do not create the source file • File -> Import… • Make sure the “src” folder is selected
Transporting a Project (Import into Eclipse) • Highlight General -> File System • Click Next
Transporting a Project (Import into Eclipse) • Browse to the folder you created when you exported the project • Check the c file you exported • Browse to your project src folder (if it’s not already shown) • Click Finish
Transporting a Project • If something goes wrong during the Import step, don’t panic, you still have the. cfile(s) in the folder you created during the Export step • You can go back and try it again
The program Get access to external code Program starting function #include <stdio. h> Statement block Statement terminator main() { printf("hello, world!n"); } String constant Formatted output function
Let’s experiment…