Before you build, you must make sure the linker knows where to find certain files. You also need to check the environment variables that affect the linker.
The files you name in the Project list must be available in the directory specified with each filename.
·To list files in a project:
1.From the Project menu, choose Edit. The Edit Project dialog box appears (Figure 9.1).
2.Add the names of your files to the Project list.
Make sure that the path shown with each file in the Edit Project dialog box is spelled correctly and corresponds to an existing directory and that a file by that name exists in that directory. The linker uses object (.OBJ), library (.LIB), and module-definition (.DEF) files. For more information on these files, see “Project Files Required for Linking” on page 206.
An environment variable is a defined identifier stored by the operating system. The string associated with an identifier can be a path (or paths), or it can be a string of characters that have meaning for a certain utility.
The Graphical Development Environment uses several DOS environment variables for finding utilities and other files needed for building your program. SETUP places these files in directories that you specify during setup, and it creates a batch file of environment variable settings for finding these files. You probably don't need to set or change these variables, but it is important to understand how they are used.
You can see the current settings of environment variables on your system by entering the SET command at the DOS prompt. For information on the SET command and environment variables, see the documentation for your operating system.
NOTE:
You cannot change environment variables while in Windows. When you start up Windows, it makes a copy of the environment. All applications refer to this copy for values of environment variables. You must exit Windows before changing LINK, LIB, PATH, or other environment variables.
The PATH Environment Variable
The PATH variable helps DOS, Windows, the Development Environment,
and other programs find executable files. The linker, LINKW.EXE, must
exist in a directory specified in PATH. If you debug your program in the
Graphical Development Environment, the utility CVPACKW.EXE must also
be in your path.
The LIB Environment Variable
SETUP creates one or more libraries, called default libraries, and sets the LIB variable to the directory containing these libraries. The linker looks for default libraries in the directory specified by the LIB variable. If you want to provide these libraries in another directory, you can either change the LIB variable or modify the Directories dialog box. For details about default libraries, see “Libraries” on page 207. For details about the Directories dialog box, see “Where the Linker Looks for Libraries” on page 208.
The LINK Environment Variable
Several kinds of linkers, including the Development Environment linker, look at the LINK environment variable for options to control linking. When using the Graphical Development Environment, it is recommended that you do not set the LINK variable but instead use the Development Environment to specify linking options. To prevent any unanticipated conflicts or side effects, you should check to see whether the LINK variable has been set on your system. Before running Windows, type SET at the prompt. If the LINK variable appears, you may want to clear it; type SET LINK= and press ENTER after the equal sign.