Appendix C
Integrated Development Environments
(IDE)
C.1 Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
C.2 Create and Build a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
C.3 Debugging the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
An Integrated Development Environment (IDE) is a program that integrates different pro-
gramming tools together into a unified user interface. In this chapter we illustrate the notion
of an IDE with Eclipse. Fig. C.1 shows the web site. This chapter uses many screenshots to
visually explain various steps when using Eclipse.
FIGURE C.1: Eclipse (www.eclipse.org) is one of the most popular IDEs.
451
452 Intermediate C Programming
C.1 Eclipse
There are several ways to install Eclipse. One is to download Eclipse from the web site.
Another is to use Ubuntu’s Software Center. After starting Eclipse, it asks you for the loca-
tion of a “workspace”. This is a folder where you keep your Eclipse programming projects.
The default location is a directory called workspace. Eclipse has a plug-in architecture for
adding features. This is one reason (possibly the most important) why Eclipse is a popular
IDE. To install a plug-in, click Help at the menubar and select Install New Software. Select
Programming Languages and C/C++ Development Tools, as shown in Fig. C.2. Eclipse
does not support the C programming language until this plugin is installed.
FIGURE C.2: Select C/C++ Development Tools.
C.2 Create and Build a Project
To create a new programming project, first click File on the menubar, and select New
and then Project. Fig. C.3 to Fig. C.11 show the procedure of building a program in Eclipse.
Integrated Development Environments (IDE) 453
FIGURE C.3: Select Makefile Project and call the project “prog1”. Click Finish.
FIGURE C.4: Add a header file.
454 Intermediate C Programming
FIGURE C.5: Call the header file prog1.h. Eclipse automatically adds #ifndef, #define,
and #endif to the header file. Add two function declarations to the header file.
FIGURE C.6: Add a new source file.
C.3 Debugging the Program
Eclipse can simplify many steps in developing a C program. Fig. C.12 to Fig. C.17 show
how to run and debug a program.
Integrated Development Environments (IDE) 455
FIGURE C.7: You can customize the code formatting style by clicking Windows and
selecting Preferences. Choose a style you like. You can experiment with different styles and
decide which suits your preferences. This example uses the GNU style.
FIGURE C.8: Set the project’s property. Depending on your version of Eclipse and the
installed plug-ins, the build environment may already be set up correctly. Click Project (on
the menubar) and select Build Project. If Eclipse says “no rule to make target all”, then
you need to set the build environment. Select “Generate Makefiles automatically” and click
Apply.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset