|
course.wilkes.edu/CS125Labs |
||||||
Lab 3a: Instructor's Notes
Since chapter 3 in the text is fairly long, we have provided two lab exercises for it: 3a and 3b. In exercise 3a, students build a separately compiled library of metric conversion functions (simple, but useful). In exercise 3b, students learn to build more complicated functions that require selective and repetitive behavior. We have our students do both exercises, 3a one week and 3b the next. Using a user-defined, separately compiled library with a program changes translation to a multi-step process:
make utility.
To use this utility, a programmer prepares a special file called a
Makefile (beginning with capital-M by convention, not necessity).
The Makefile consists of a series of pairs lines of the form:
TargetFile: ComponentFile1 ComponentFile2 ... ComponentFileN
Command
where Command is a UNIX command that
makes TargetFile from the N ComponentFiles.
Command must be preceded by a TAB and followed by a
RETURN (or ENTER).
To illustrate, our binary executable program
driver: driver.o Metric.o
g++ driver.o Metric.o -o driver
Similarly, driver.o is made by compiling driver.cpp</TT,
which includes (and thus depends upon) |
Home Membership
|
|||||
|
Last update: Tuesday, August 22, 2000 at 4:12:48 PM. |
||||||