Have you found a great sample in the Windows SDK but wish it could target 64-bit platforms?  Not all of our samples have 64-bit support, but it’s quick and easy to configure the sample yourself using the project configurations available in the Visual Studio Integrated Development Environment (IDE).

To develop 64-bit applications you must install one or both of the Visual C++ 64-bit compilers.  Without these compilers on your dev machine, 64-bit project configurations will not be available in the IDE. See Installing Visual Studio 64-bit Components on MSDN for more about this. 

 

First, I’ll describe how to change the active project configuration to target 64-bit platforms using the Visual Studio IDE. Next, I’ll describe how to migrate Win32 project settings into a 64-bit project configuration.

How to: set up C++ applications to target 64-bit platforms

1.       Using Visual Studio, open the C++ project that you want to configure to target a 64-bit platform.

2.       Open the property pages for that project. (Right-click the project node in Solution Explorer and click Properties.)

 

3.       Click Configuration Manager to open the Configuration Manager Dialog Box.

4.       Click the Active Solution Platform list, and then select the <New…> option to open the New Solution Platform Dialog Box.

5.       Click the Type or select the new platform drop-down arrow, and then select a 64-bit platform. (64-bit platform will not be available if you don’t have a 64-bit compiler installed.) In the New Solution Platform dialog box, you can copy existing project settings into the new 64-bit project configuration using the Copy settings from option.

6.       Click OK. The platform you selected in the preceding step will appear under Active Solution Platform in the Configuration Manager dialog box.

7.       Click Close in the Configuration Manager dialog box, and then click OK in the <Projectname> Property Pages dialog box.

To copy Win32 project settings into a 64-bit project configuration

  1. When the New Solution Platform dialog box is open while you set up your project to target a 64-bit platform, click the Copy settings from drop-down arrow, and then select Win32. The project settings listed below are automatically updated on the project level:

o    /MACHINE (Specify Target Platform) is set to /MACHINE:IA64 or /MACHINE:X64.

o    Register Output is turned OFF. For more information, see Linker Property Pages.

o    Target Environment is set to /env x64 or /env ia64. For more information, see MIDL Property Pages: General.

o    Validate Parameters is cleared and reset to the default value. For more information, see MIDL Property Pages: Advanced.

o    If Debug Information Format was set to /ZI in the Win32 project configuration, then it is set to /Zi in the 64-bit project configuration. For more information, see /Z7, /Zi, /ZI (Debug Information Format).

o    Values of WIN32 are replaced by WIN64 for /D (Preprocessor Definitions).

Note: none of these project properties are changed if they are overridden at the file level.

How to: Add 64-bit support to .vcproj files - Twango

Karin Meier-Magruder

Windows SDK Samples Program Manager