Reference

Visual C++ Express, Microsoft Windows SDK & Windows Vista 64-bit

This article describes how to use Visual Studio C++ 2005 Express Edition with the new Microsoft Windows SDK on 64-bit Windows Vista systems. It will, at least for the better part, apply to other Windows Operating systems as well.

Tags: c++ directx dotnet programming windows

Prerequisites

This article assumes that you have a working installation of Windows Vista 64-bit. Please note that only the Vista Ultimate Edition has 64-bit media included. All other Vista editions contain 32-bit media only. The 64-bit media for those editions can be purchased on the Windows Vista Alternate Media page. MSDN subscribers receive the media automatically.

At this point you should run Windows Update to see if there are any updates for either installation. At the time of writing this, the following important updates were available:

I used the default directories for all installations, but it doesn't really matter where you install everything, as long as you remember the paths. Now get ready for the messy part!

Include Paths

The paths to include files, libraries and tools of the Windows SDK are not automatically added to the environment or registered with Visual C++ 2005 Express Edition after installation. In order to avoid having to configure them for each individual project, it is recommended that you add them to your Visual Studio default settings. This is accomplished in the following steps:

  1. Start Visual C++ 2005 Express Edition
  2. Select Options... from the Tools menu
  3. In the Options dialog box, expand the Projects and Solutions node and select VC++ Directories
  4. Select Executable files from the drop down box on the top right and add the following path: {windowssdk_install_path}\Bin
    (e.g. C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin)
  5. Select Include files from the drop down box and add the following path: {windowssdk_install_path}\Include
    (e.g. C:\Program Files\Microsoft SDKs\Windows\v6.0\Include)
  6. Select Library files from the drop down box and add the following path: {windowssdk_install_path}\Lib
    (e.g. C:\Program Files\Microsoft SDKs\Windows\v6.0\Lib)

The same steps have to be taken for the include files and libraries in the DirectX SDK:

  1. Select Include files from the drop down box and add the following path: {directxsdk_install_path}\Include
    (e.g. C:\Program Files (x86)\Microsoft DirectX SDK (February 2007)\Include)
  2. Select Library files from the drop down box and add the following path: {directxsdk_install_path}\Lib\x86
    (e.g. C:\Program Files (x86)\Microsoft DirectX SDK (February 2007)\Lib\x86).

The placeholders {windowssdk_install_path} and {directxsdk_install_path} refer to the Windows SDK and DirectX SDK installation directories. Please note that, on your machine they might not be the same as in the examples shown above if you chose to install the SDKs in a directory different from the default, or if your SDKs are a different version. Replace them with the ones specific to your own installation directories and SDK versions.

Default Libraries

By default, Visual C++ 2005 Express Edition does not have the standard Windows libraries configured. To avoid linker errors when building SDK Sample projects, you should add the standard libraries to the list of additional library dependencies:

  1. Navigate to the %VSINSTALLDIR%\VC\VCProjectDefaults directory, where %VSINSTALLDIR% stands for the installation directory of Visual C++
    (e.g. C:\Program Files (x86)\Microsoft Visual Studio 8)
  2. Open the file corewin_express.vsprops in a text editor
  3. Change AdditionalDependencies="kernel32.lib" in the Tool entry to include all Windows core libraries. Your file should look like this:

    
    <?xml version="1.0"?>
    <VisualStudioPropertySheet
          ProjectType="Visual C++"
          Version="8.00"
          Name="Core Windows Libraries">
          <Tool
                  Name="VCLinkerTool"
                  AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib" />
    </VisualStudioPropertySheet>

The core libraries should now be automatically included for all projects. If you do not wish to use some of these libraries in any of your projects, you can explicitly ignore them in the Ignore Input Library setting of your project's Properties.

Win32 Application Wizard

If you are used to create new Windows applications using the project wizzard, you will notice that the application wizzard template for Win32 applications is disabled in Visual C++ Express Edition. It can be enabled again by editing the appropriate settings file:

  1. Navigate to the directory %VSINSTALLDIR%\VC\VCWizards\AppWiz\Generic\Application\html\1033
    (e.g. C:\Program Files (x86)\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\1033)
  2. Open the file AppSettings.htm in a text editor
  3. In the function InitControls() comment out the following lines:

    WIN_APP.disabled = true;
    WIN_APP_LABEL.disabled = true;
    DLL_APP.disabled = true;
    DLL_APP_LABEL.disabled = true;

    Your result should look like this:

    //WIN_APP.disabled = true;
    //WIN_APP_LABEL.disabled = true;
    //DLL_APP.disabled = true;
    //DLL_APP_LABEL.disabled = true;

You will also have to modify the script that is used to set up new projects:

  1. Navigate to the directory %VSINSTALLDIR%\VC\VCWizards\AppWiz\Generic\Application\scripts\1033
    (e.g. C:\Program Files (x86)\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\scripts\1033)
  2. Open the file default.js in a text editor
  3. In the function OnFinish() comment out the two lines containing
    LinkTool.AdditionalDependencies = "kernel32.lib $(NoInherit)";

DirectX

The DirectX SDK installation should work out of the box and not require any manual intervention. If you are experiencing problems compiling DirectX applications, particularly the DirectX samples in the Windows SDK, make sure that the following settings are correct:

  1. In the system environment variables there should be an entry DXSDK_DIR containing the installation directory of the DirectX SDK
    (e.g. C:\Program Files (x86)\Microsoft DirectX SDK (February 2007))

Help Files

The last step is configuring the context sensitive help for the Windows SDK. Again, this has to be done manually for Visual C++ 2005 Express Edition:

  1. Start Visual C++ 2005 Express Edition.
  2. Press F1 to open the Microsoft Document Explorer.
  3. Paste the following address into the URL box and press Enter:
    ms-help://MS.VSExpressCC.v80/dv_vsexpcc/local/CollectionManagerExpress.htm
  4. At the bottom of the page is a list of Collections available for inclusion in VSExpressCC; check the box for Microsoft Windows SDK
  5. Click the Update VCExpressCC button and confirm the two message boxes
  6. Close Microsoft Document Explorer and restart Visual C++ Express
  7. Restart Visual C++ 2005 Express Edition and press F1 to open the Microsoft Document Explorer; the context sensitive help should now reconfigure itself to include the Windows SDK documentation.

The context sensitive help for Win32 applications should now be available. Please note that many entries for Windows API functions default to their .NET counterparts. Google often delivers better results when searching for API documentation.

If you painstakingly went through all the steps described in the previous paragraphs, you should now be able to build and test Windows SDK and Direct SDK samples, as well as your own Windows and DirectX based applications.

Related Resources

There already is some information on this topic for 32-bit versions of Windows available online. Microsoft has a special page in the Visual Studio Express section, an entry in the MSDN Knowledge Base and another article in Brian Johnson's Weblog. There is also an article on The Code Project, which attempts to give a conclusive summary.

MCF/ATL/WTL Notes

Visual C++ 2005 Express Edition does not include header files or libraries for MFC, ATL and WTL, and these files are also not included in the Windows SDK. Therefore, many Windows SDK sample projects will fail to build. More information on this issue, including a list of affected sample projects can be found in the Windows SDK Release Notes. The Code Project has an article on using WTL with Visual C++ 2005 Express Edition.