130

Is there a simple way to compile a 64 bit app with the 32-bit edition of Visual C++ 2010 Express? What configurations, if any, are necessary?

Nathan Osman
  • 71,149
  • 71
  • 256
  • 361

8 Answers8

182

Here are step by step instructions:

  1. Download and install the Windows Software Development Kit version 7.1. Visual C++ 2010 Express does not include a 64 bit compiler, but the SDK does. A link to the SDK: http://msdn.microsoft.com/en-us/windowsserver/bb980924.aspx
  2. Change your project configuration. Go to Properties of your project. On the top of the dialog box there will be a "Configuration" drop-down menu. Make sure that selects "All Configurations." There will also be a "Platform" drop-down that will read "Win32." Finally on the right there is a "Configuration Manager" button - press it. In the dialog that comes up, find your project, hit the Platform drop-down, select New, then select x64. Now change the "Active solution platform" drop-down menu to "x64." When you return to the Properties dialog box, the "Platform" drop-down should now read "x64."
  3. Finally, change your toolset. In the Properties menu of your project, under Configuration Properties | General, change Platform Toolset from "v100" to "Windows7.1SDK".

These steps have worked for me, anyway. Some more details on step 2 can be found in a reference from Microsoft that a previous poster mentioned: http://msdn.microsoft.com/en-us/library/9yb4317s.aspx.

rogerdpack
  • 62,887
  • 36
  • 269
  • 388
Matt
  • 2,846
  • 2
  • 17
  • 12
  • 2
    Congratulations - your answer just earned you 275 rep. Thanks for an awesome answer! – Nathan Osman Dec 22 '11 at 19:55
  • I have Windows XP but the SDK is for Windows 7. Will this still work? – David G May 02 '13 at 00:40
  • @0x499602D2: I don't know. I would hope that if the Visual C++ and SDK versions were the same, it would. Did you try it? – Matt May 15 '13 at 16:24
  • Fails here: The Platform drop-down of my project has no "New" item to select. – Rene May 24 '13 at 10:12
  • 2
    This worked for me only after installing patches 3 and 4 mentioned here: http://stackoverflow.com/a/8334985/429873 – Dmitry Trofimov Aug 12 '13 at 14:32
  • 1
    @Matt: this all works for me on WinXP 64bit. What is the reason to change Platform Toolset to Win7.1SDK? – IgorStack Jul 03 '14 at 00:03
  • In my case, I am at Step 3, and I did not see "Properties | General", i need to install [this](http://www.microsoft.com/en-us/download/details.aspx?id=4422) to have my project successfully compiled for x64 platform. – Kong Chun Ho Sep 24 '17 at 10:33
48

64-bit tools are not available on Visual C++ Express by default. To enable 64-bit tools on Visual C++ Express, install the Windows Software Development Kit (SDK) in addition to Visual C++ Express. Otherwise, an error occurs when you attempt to configure a project to target a 64-bit platform using Visual C++ Express.

How to: Configure Visual C++ Projects to Target 64-Bit Platforms

Ref: http://msdn.microsoft.com/en-us/library/9yb4317s.aspx

YOU
  • 120,166
  • 34
  • 186
  • 219
  • is this available for VB 2010 Express? – Remus Rigo Sep 05 '11 at 17:36
  • For some reason my $(WindowsSdkDir) didn't seem to work right but once I added in the absolute paths manually it worked a champ. – rogerdpack Sep 21 '11 at 23:51
  • 5
    After following the instructions I kept getting blank property pages for the x64 platform. I had to install the compilers update [here](http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=4422). More info at [KB2519277](http://support.microsoft.com/kb/2519277). – kipkennedy Dec 30 '11 at 23:48
14

And make sure you download the Windows7.1 SDK, not just the Windows 7 one. That caused me a lot of head pounding.

Jamie Fristrom
  • 341
  • 4
  • 11
9

I found an important step to add to this - after you've installed the SDK, go to your project properties and change Configuration Properties->General->Platform Toolset from v100 or whatever it is to Windows7.1SDK. This changes $(WindowsSdkDir) to the proper place and seemed to solve some other difficulties I was encountering as well.

Matt
  • 2,846
  • 2
  • 17
  • 12
5

Note that Visual C++ compilers are removed when you upgrade Visual Studio 2010 Professional or Visual Studio 2010 Express to Visual Studio 2010 SP1 if Windows SDK v7.1 is installed.

For instructions on resolving this, see KB2519277 on the Microsoft Support site.

4

Download the Windows SDK and then go to View->Properties->Configuration Manager->Active Solution Platform->New->x64.

duduong
  • 41
  • 1
3

Programming in a 64-bit environment is quite different than 32-bit environment. Code generated has totally different assembly constitution in 32 & 64-bit code, even the protocols of communicating with functions change. So you can't generate 64-bit code using 32-bit compiler.

You might want to see an article on Microsoft's web site about targeting a 64-bit target but using a 32-bit development machine.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
perilbrain
  • 7,961
  • 2
  • 27
  • 35
2

As what Jakob said: windows sdk 7.1 cannot be installed if MS VC++ x64 and x86 runtimes and redisrtibutables of version 10.0.40219 are present. after removing them win sdk install is okay, VS C++ SP1 can be installed fine again.

Kind regards

Hadrien Huvelle
  • 382
  • 2
  • 11