Build Tool (Build.exe)

Build Tool (Build.exe) (Compact 2013)


The Windows Embedded Compact Build tool (Build.exe) builds the source code in a directory and in specified subdirectories

build [options]


Display a list of command-line options for Build.exe.


Display progress and informational messages in console output.


Perform a clean build. Delete all existing target files before building.


Equivalent to -nmake clean.

-j Filename

Specifies the name for the created log files.

For example, if MyLogFile is specified using this parameter, the log files MyLogFile.err, MyLogFile.wrn, and MyLogFile.log are created.


Run Build.exe in the idle priority class.

-M[n + 1]

Configures Build.exe to run on development computers that have n microprocessors installed. For more information, see BUILD_MULTIPROCESSOR, located in Miscellaneous Environment Variables.

If the dirs and sources files in your OS design have dependencies, this can cause synchronization issues. For more information, see <BuildPassName>_PRODUCES and <BuildPassName>_CONSUMES.

-nmake Arg

Invoke Nmake.exe with the specified arguments. For information on argument usage, see NMAKE Reference on MSDN.


Generate only an _Objects.mac (list of object targets) file.


Remove the message prefix from the console output.


Intended for internal use. Reuse _table.mac (macro list), do not call nmake clean, and then rebuild all targets regardless of dependencies.

-x includepath

Exclude the specified path from the list of include directories that are scanned during analysis.


Enable verbose scanning information.


Exclude all directories that use the specified name from the build.


Specifies a text file that contains a list of additional source directories, using the format of one directory per line.

The following table lists error messages returned by Build.exe.

Error message


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 Build.exe is running 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 that outlines your subdirectories in the current directory of your source code tree.
  • A sources file in each subdirectory specified in the dirs file.

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.

The Build.exe file is in the <Installation Directory>\Public\Common\Oak\Bin\i386 directory.

The Windows Embedded Compact Build tool differs significantly from the Build utility in the Windows Driver Kit (WDK). Several environment variables differ, as do many sources file entries.

Build.exe performs the following procedure 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, it 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 .exe, .dll, or static .lib file and places it in the applicable subdirectory of the %SG_OUTPUT_ROOT%\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 type


    .exe, .dll


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



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

The following table shows the log files and their contents.

Log file



Contains a log of commands invoked by Nmake.exe.


Contains a list of warnings generated during the build process.


Contains a list of errors generated during the build process.

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.

Dirs File

A text file that you use to specify subdirectories that contain source code you want to build into a run-time image using Build.exe.

Makefile File

A Makefile file specifies to Build.exe how to build source files.

Module-Definition File

A text file which contains statements defining the public symbols, functions and variables that are exported from an executable file.

Sources File

A text file that sets the macro definitions for the source code in a subproject's subdirectory.

© 2016 Microsoft