456 Intermediate C Programming
FIGURE C.9: When you click Project and select Build Project, Eclipse will say “undefined
reference to addtwo” and “undefined reference to subtwo”. This should be expected because
these functions have not been implemented. Eclipse’s error message is displayed in the
Console. Eclipse also highlights the two lines that have the errors.
FIGURE C.10: To solve the build problem, we add another source file called addsub.c
and in this file we define the two functions.
Integrated Development Environments (IDE) 457
FIGURE C.11: When you build the project, Eclipse should say that the project is built
successfully. A valid Makefile is automatically generated by Eclipse.
FIGURE C.12: Running: Click Run in the menubar and then select Run.
458 Intermediate C Programming
FIGURE C.13: The program’s output is shown in the Console.
FIGURE C.14: Eclipse uses gdb to debug programs, and also provides a convenient user
interface. To debug a program, click Run and select Debug.
Integrated Development Environments (IDE) 459
FIGURE C.15: Eclipse starts the program and stops at the first statement in main. This
is denoted by the arrow that is shown at line 13.
FIGURE C.16: Eclipse knows how to communicate with gdb, and provides a convenient
method for common debugging commands such as step over, step into, and toggle break-
point. Move the mouse cursor to line 18 in the source code, and toggle line breakpoint.
460 Intermediate C Programming
FIGURE C.17: Click Window, Show View, and Variables. Here you can see the values of
variables as the code executes. Note that the value of c is 96.
..................Content has been hidden....................

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