Environment Variables for Cl.exe and Link.exe

The compilers for the Windows CE processors (Cl.exe, Clarm.exe, Clmips.exe, Clppc.exe, Clthumb.exe, Shcl.exe) invoke the preprocessor and compiler; and Link.exe invokes the linker. The compiler can invoke the linker as well, so you do not have to invoke Link.exe directly in most cases. In the BIN folder for each version of the Windows CE operating system, there is a different compiler command (CL, CLARM, CLMIPS, CLPPC, CLTHUMB, and SHCL) and corresponding executable for the different processors supported by the version of the operating system.

Note These environment variables are required for building a project with the NMAKE command. They are not required for building a project using Evc.exe on the command line.

The compilers and LINK (and other command-line utilities, see eMbedded Visual C++ Utilities) require that certain environment variables be properly set:

  • Cl.exe uses CL and INCLUDE.

    Cl.exe processes options and arguments defined in the CL environment variable (if included) before processing the command line. INCLUDE must point to the \include subdirectory of your eMbedded Visual C++ installation.

  • Link.exe uses LINK, LIB, PATH, and TMP.

In the BIN folder for each version of the Windows CE operating system, Microsoft eMbedded Visual C++ provides batch files for each CPU supported by the OS version to set the PATH, LIB, and INCLUDE environment variables, if they are not already set. For each operating system, there are currently one or more of the following files: Wcesh3.bat, Wcemips.bat, X86em.bat, Wceppc.bat, Wcex86.bat, Wcearm.bat, Wcesh4.bat, Wcemipsfp.bat, and Wcethumb.bat.

You should also set the TMP environmental variable if it is not set already. The processes will probably work without the CL environmental variable, but you may want to define it as well. The CL environmental variable is used to pass options to the compiler that are not specified on the command line.

You can find the environment batch files in the \bin subdirectory of your eMbedded Visual C++ installation and run it from the MS-DOS Command Prompt. The environment variable settings are only for the command environment. You do not need to run the environment batch files to build within the eMbedded Visual C++ IDE.

To run the environment batch files

  1. Open an MS DOS command prompt window.
  2. At the command prompt, change to the \bin subdirectory of for the appropriate Windows CE operating system in the eMbedded Visual C++ installation.
  3. Run the batch file for the appropriate target CPU.

Note   The environment batch files are provided as templates. You may need to modify them for your particular development needs.

Caution   The content of the environment batch files can depend on the computer on which you installed eMbedded Visual C++. Do not replace a missing or damaged environment batch file from another computer. Rerun eMbedded Visual C++ Setup to replace the missing file.

Setting the CL Environment Variable

To set the CL environment variable, use the following syntax:

SET CL=[ [option] ... [file] ...] [/link link-opt ...]

You can use this environment variable to define the files and options you use most often and use the command line to define specific files and options for specific purposes. The length of the CL environment variable setting is limited to the command-line input limit of your operating system (usually 1,024 characters).

You cannot use the /D option to define a symbol that uses an equal sign (=). You can substitute the number sign (#) for an equal sign. In this way, you can use the CL environment variable to define preprocessor constants with explicit values (for example, /DDEBUG#1).

Example

The following example of a CL environment variable setting:

SET CL=/Zp2 /Ox /I\INCLUDE\MYINCLS \LIB\BINMODE.OBJ

is equivalent to the following CL command:

CL /Zp2 /Ox /I\INCLUDE\MYINCLS \LIB\BINMODE.OBJ INPUT.C

The following example causes CL to compile the source files FILE1.c and FILE2.c, and then link the object files FILE1.obj, FILE2.obj, and FILE3.obj:

SET CL=FILE1.C FILE2.C
CL FILE3.OBJ

This has the same effect as the following command line:

CL FILE1.C FILE2.C FILE3.OBJ

See Also

Building Applications on the Command Line, Link Environment Variables, Setting Compiler Options