Defining x64 Target Platform for VC++ Projects

If you want to port an existing 32-bit application for the x64 platform (especially since 32-bit processors will soon be history), or if you want to target x64 for a new application, the first step in building for x64 is setting up your solution. In this post I will explain what are the steps in configuring x64 as target platform for your projects. Of course you must have the 64-bit compiler and tools installed to make this possible.

Here is an example of a solution with two VC++ project (a Win32 DLL and a console application).

The VC++ wizards add only Win32 (i.e. x86) as target platform for your projects and for your solution (I believe this will change in the future). You can see this by expanding the platforms combo.

If you open the Configuration Manager window for the solution you can see the available solution platforms, and for each project, the available project platforms (these might not be the same).

The configuration manager allows you to set for each pair of solution configuration and solution platform the platform for each individual project. So in theory you can configure for Debug with Win32 at solution level to have, in my demo solution, DemoProject targeting Win32 and DemoLibrary targeting x64. Of course, in practice you probably want to have all projects targeting Win32 in this case, and for the pair Debug with x64 at solution level, have all projects targeting the x64 platform.

To make this platform available for the solution, expand the Active solution platform combo and select . The New Solution Platform dialog will open and allow you to define a new target platform for the solution. Select x64 and for Copy settings from select Win32.

Then make sure you check the Create new project platforms checkbox. In this case the x64 platform will also be defined for every project included in the solution.

After you do this, the x64 platform will be available in the configuration manager for the solution and the projects, so that you can configure the relationships.

Also, the solution platforms combo from the toolbar now displays both Win32 and x64.

But now let’s say you add a new project to the solution. Let’s call this DemoLibrary2.

Since the project was added after defining x64 as a target for the solution and all the projects, the x64 platform won’t be defined for this project (remember, by default, the VC++ wizards don’t add x64 as target platform). You can see this in the configuration manager, where only Win32 is available for the new project.

To define the x64 target for the new project, use the project platform combo and select (see the image above) to open the New Project Platform dialog. Select x64, as new platform, but make sure the checkbox Create new solution platforms remains unselected. Otherwise you’ll get an error, since the platform is already available at the solution level.

After that, the x64 platform will be available for the new project too, and you can make the appropriate configurations in the Configuration Manager window.

And with that you’re done. All you have to do now is configure the settings for each project, for each configuration and platform.

6 Replies to “Defining x64 Target Platform for VC++ Projects”

  1. Hello sir,
    When I want to create new project platforms, there is no x64. The list is empty. So, what should I do to add x64 to the list?

    My operating system is windows 7 64bit.

    Sincerely
    Bandar

  2. You must have the 64-bit compiler tools installed with Visual Studio. You do that when you installed the studio. Of course you can do it any time later, but if you already installed the service pack (SP1) you must uninstall the service pack first, then install the 64-bit tools and then install the service pack again.

  3. Hello sir,
    But when I opened Visual Studio, there is no x64. About SP1, I don’t know whether I installed it or not.
    So, could you please guide me to solve this problem ?
    King regards
    Bandar

  4. Open Visual Studio, go to Help > About Microsoft Visual Studio and check the version. If you have there SP then you have the service pack. But if you don’t know whether you installed it, it’s likely you don’t have it. As I said, you must install the 64-bit tools when you install Visual Studio. You won’t find them in Visual Studio if you don’t install them.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.