How to Build with NMAKE

NMAKE is the command-line project-management facility provided with Microsoft C/C++. This section explains how to build the tutorial programs from the DOS command line with NMAKE. Although NMAKE isn't required for the tutorial examples, if you are unfamiliar with NMAKE and would like more explanation, see the documentation for NMAKE in Environment and Tools.

·To build your program with NMAKE, do the following:

1.At the DOS command line (or in a DOS command shell from Windows), type

NMAKE <makefile name>

This command is not case sensitive.

Use the appropriate makefile name for your program. The names for the tutorial examples are shown below.

For DMTEST, Chapter 2, use DMTEST

For HELLO, Chapter 3, no makefile name is required (default of MAKEFILE is used)

For PHBOOK, Chapters 4 through 6, use PHBOOK

For CMDBOOK, Chapter 4, use CMDBOOK

2.If you supply additional arguments to NMAKE, you must add the /F compiler option:

NMAKE /F <makefile name> [[other arguments]]

The /F compiler option is not required when only one argument is given.

3.When the build completes, debug and rebuild the program if necessary. If you make changes to your source files, NMAKE rebuilds the files that have changed and any files that depend on them.

4.After a successful build, run the program to test it. For information about running your programs, see “How to Run Your Program” on page 13.