Compiling and Linking a Program

When you work within the integrated development environment, compile and link a project by clicking Build from the Build menu, or by clicking the Build button on the toolbar. You can also compile individual project files by clicking Compile from the Build menu, or by clicking the Compile button on the toolbar. When you work from the command line, you can compile and link individual project files.

Note When linking files, use the correct subsystem flag for the platform you are targeting. If you are working within the Visual Studio IDE, the correct flag is provided automatically; do not change it. When working from the command line, refer to the following table to specify the correct subsystem flag.

Target Platform Subsystem Flag
Standard Win32 target -subsystem:windows
Windows CE Emulation -subsystem:windows
-windowsce:emulation
Windows CE remote target device -subsystem:windowsce

    To prepare to build

  1. On the Project menu, click Set Active Project. This will ensure that the project you want to build is the active project.
  2. On the Build menu, click Set Active Project Configuration to select a target platform, and to specify whether to build a debug or release version of the active project.
  3. On the Project menu, click Settings and verify that the correct settings are displayed on all of the tabs in the Project Settings dialog box.
  4. To automatically download your program to the remote device after building it, click to select Always Download on the Build menu. Clear the Always Download option if you do not have a remote device connected to the desktop computer.
  5. If you are building for a remote device, make sure the device is properly connected to and communicating with the desktop computer. On the Tools menu, click Remote Connection Server to establish a connection.

Tips Activate the Build Toolbar to make it easier to select your active project configuration. If screen space is limited, deactivate the default Build MiniBar. To configure toolbars, choose Customize from the Tools menu and select the Toolbars tab.

Keep the Download Always option selected on the Build menu so you will not need to use Update Remote Output File after each build.

Windows CE sample programs are in the \WCE\Samples\Win32 subdirectory of your Visual Studio installation, and are documented in the InfoViewer under Windows CE SDK.

Do not keep two separate image source pools to develop for emulation and remote targets at the same time. If the link flags are set correctly, the images will be converted between 4-color and 16-color bitmaps automatically during linking.

    To build and download

  1. On the Build menu, click Build to compile and link only the active project

    -or-

    click Rebuild All to rebuild the dependencies of the active project.

  2. If you have selected the Always Download option and you are building for a remote target platform, you will be prompted for information about file names and locations.
  3. Follow the progress of the compiling and linking process in the Build window.
  4. If you want to download a program to the remote device without building it, on the Build menu, click Update Remote Output File.

Notes To open a command-line window with appropriately set environment variables, use the icons installed in the Windows CE Toolkit for Visual C++ 5.0 program group.

Different target platforms require different compilers.

The LINK and LIB commands have been augmented with support for the SH3 platform in the /MACHINE flag. The new syntax is:
/MACHINE:{I386|MIPS|ALPHA|PPC|M68K|MPPC|SH3}

Download your program to a remote Windows CE device from the command line using pfile.exe. (DevStudio\SharedIDE\bin). Type pfile at the command prompt for more information.