Build Tool (Windows CE 5.0)

Windows CE 5.0
Send Feedback

The Windows CE Build tool (Build.exe) builds the source code in a directory and in specified subdirectories. Build.exe uses dirs and sources files to determine the following:

  • Which directories to traverse
  • Which C-language and Microsoft Visual C++® source files to compile
  • What type of binary file to build
    Note   The Microsoft® Windows CE Build tool differs significantly from the Build utility in the Microsoft Windows NT® 4.0 Device Driver Kit (DDK). Several environment variables differ, as do many sources file entries.

Build.exe performs the following procedures in each directory it runs:

  1. Build.exe looks for a dirs file in the current directory; then, if the dirs file exists, the file directs Build.exe to additional subdirectories that contain source code or additional dirs files.
  2. If there is no dirs file in the current directory, Build.exe searches for a sources file.

    The sources file contains a list of C or C++ source files to compile, and the type of executable file to build, if any.

  3. If Build.exe finds a sources file in the current directory, Build.exe calls the Microsoft Program Maintenance Utility (Nmake.exe), also known as the Nmake tool, to compile the specified C or C++ sources files or to link an object module.

    When successful, Build.exe completes a binary executable file (.exe), dynamic-link library file (.dll), or static Common Object File Format file (.lib) and places it in the applicable subdirectory of the %PROJECTOAKROOT% directory.

    The %PROJECTOAKROOT% directory is equivalent to the %_PROJECTROOT%\Oak directory. In general, you can build only one binary file in a subdirectory, either a .lib, .exe, or.dll file.

    The following table shows the subdirectory where Build.exe places completed binary files.

    File typeSubdirectory
    .exe, .dllTarget\%_TGTCPU%\%WINCEDEBUG%.

    If the environment variable WINCEREL is defined, the .exe or .dll file is also copied to the %_FLATRELEASEDIR% directory.

build [Parameters]


Displays a list of command-line options for Build.exe, in the Public\Common\Oak\Bin\i386 directory in the directory where you installed the Windows CE OS.

This list is displayed when the current directory contains buildable content.

Displays the full text of error messages.
Deletes all object files.
Deletes all .lib object files.
Executes -nmake clean.
Displays debug information.
Generates Build.log, Build.wrn, and Build.err files in which Build.exe stores messages produced during the build process.
Keeps the Build.log, Build.wrn, and Build.err files (use with -z).
Prints the full path when displaying errors and warnings to stdout.
Ignores compiler warning messages.
-j File
Uses File as the name for log files.
Keeps out-of-date targets.
Runs a link pass only; does not compile.
Runs a compile pass only; does not link.
Runs Build.exe in the idle priority class.
-M [n]
Runs Build.exe on n microprocessors (for multiprocessor computers).

If the dirs and sources files in your OS design have dependencies, this can cause synchronization issues. For more information, see SYNCHRONIZE_DRAIN and SYNCHRONIZE_BLOCK.

-nmake Arg
Invokes Nmake.exe with Arg.
Displays out-of-date files.
Generates an _Objects.mac file for the current directory.
Pauses before compile and link phases.
Prints the elapsed time after every directory.
Queries dependencies only; does not run Nmake.exe.
-r Directory
Restarts a clean build at Directory.
Displays a status line at the top of the command window.
Displays a status line with include file line counts.
Displays the first level of the dependency tree.
Displays the dependency tree.
Displays the dependency tree hierarchically.
Displays unused BUILD_OPTIONS.
Enables include-file version checking.
Shows warnings on screen.
Lists reasons for building targets.
-x File
Excludes the include file from dependency checks.
Shows files that are scanned.
Does not check dependencies of or scan source files — one-pass compile and link.
Does not check dependencies of or scan source files — two-pass compile and link.
Specifies additional source directories.

Error Messages

  • No _TGTCPU environment variable set
  • No _TGTCPUFAMILY environment variable set
  • Unknown _TGTCPU variable

    The environment variables %_TGTCPU% or %_TGTCPUFAMILY%, which are normally set by Wince.bat, were not set. This error generally occurs if you did not use Wince.bat to start the command prompt build window for your OS design.

  • Error finding topmost directory containing dirs file

    The current directory in which you run Build.exe does not contain a dirs file or a sources file. Build.exe cannot determine which code directories to build. To troubleshoot, be sure you have the following:

    • A dirs file, outlining your subdirectories, in the current directory of your source code tree.
    • A sources file in each subdirectory specified in the dirs file.


The following code example shows how to use Build.exe to perform a clean build that forces a rescan of all source and include files.

build -cfs


During the build process, Build.exe generates several log files in the root directory where it was called.

The following table shows the log files and their contents.

Log fileDescription
Build.logContains a log of commands invoked by Nmake.exe.
Build.wrnContains a list of warnings generated during the build process.
Build.errContains a list of errors generated during the build process.
Note   Build.exe reports some compiler and linker warnings only in the Build.wrn file. Do not expect all warnings to be returned as messages in the command prompt build window.

See Also

Building a Run-Time Image That Supports the Kernel Profiler | Sysgen Tool

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.