Compile 64 bit application in MSVC 2010 - c++

We need to compile our libraries in MSVC++ 2010 with 64 bit support.
After reading answers on this question, I still don't understand why it's necessary to change the platform toolset from "v100" to "Windows7.1SDK".
Is it necessary only for MSVC Express, or also for full MSVC version?
What does it change? And what is the risk if you don't change the toolset?
I mean, I can successfully generate 64bit binaries with default v100 toolset, what's wrong with that?

It is a hack to work around Express edition limitations, somewhat south of its license restrictions. When you have the paid edition, you simply add the x64 configuration to get a 64-bit build of your app. Use Build + Configuration manager, upper right combobox box labeled "Active Solution Platform". Pick "New" from that combobox. Pick "x64" in the popup. Done.
If "x64" doesn't appear then re-run Setup and select the option to install the 64-bit compilers.

The setting is necessary for Visual Studio 2010 Express. That doesn't come with a 64 bits compiler, so you have to tell it to use the SDK compiler. With the paid-for versions, a 64 bit compiler is included.

Related

Visual Studio 2015 - missing 64 bit compiler

Currently I'm working with Visual Studio 2015 on a 32-Bit computer and create 32-bit applications in C++/CLI.
As far as I remember one could choose between creating 32 and 64-Bit applications in previous Visual Studio versions, if one has installed the 64-Bit compiler too.
Today I was trying to get the same functionality out of the 2015's version of Visual Studio, but I'm not able to find any option to install the 64-Bit compiler.
In the compiler-settings I can only choose between ARM and 32-Bit (no 64-Bit, no "any platform"). Running the Visual Studio Setup from the Windows system preferences also shows no possibility to install the 64-Bit compiler (or maybe i just don't know what to install).
QUESTION: How can I install the 64-Bit C++ compiler for Visual Studio 2015 on a 32-Bit computer?
#GSerg gave the aswer I needed in his first comment - thank you for your help!
The compiler seems to be installed by default. I just wasn't able to find the way to set the platform.

Enabling MSVC10 Platform toolset in VS2012 64bit project [duplicate]

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?
Here are step by step instructions:
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
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."
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.
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
And make sure you download the Windows7.1 SDK, not just the Windows 7 one. That caused me a lot of head pounding.
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.
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.
Download the Windows SDK and then go to View->Properties->Configuration Manager->Active Solution Platform->New->x64.
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.
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

compile 64 bit under visual studio 2010

I have a 32 bit operating system and i am under visual studion 2010. I was wondering if i can compile a 64-bit MFC application with VS2010 under my OS.
Thank you.
Yes, VS2010 has a cross-compiler in the vc/bin/x86_amd64 subdirectory. It is automatically used when you add the x64 platform to your solution. If you don't see it then re-run setup to add the 64-bit compilers.
You of course can't test it.
In the Configuration Manager, add a new solution platform. If you have the x64 compilers and tools installed, 'x64' should be listed as an available option.
Yes, you can compile the code, but you can not run it. In order to run the code, you need to specify the run-time environment.

How to compile a 64-bit application using Visual C++ 2010 Express?

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?
Here are step by step instructions:
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
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."
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.
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
And make sure you download the Windows7.1 SDK, not just the Windows 7 one. That caused me a lot of head pounding.
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.
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.
Download the Windows SDK and then go to View->Properties->Configuration Manager->Active Solution Platform->New->x64.
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.
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

Visual Studio 2008 sp1 vc++ project works in 32 bit mode, but not 64 bit

I have a project that runs perfectly well under windows 7, x86 installation. On the same machine, but in a different drive, I've installed windows 7, x64, and visual studio 2008 sp1 on both.
The project compiles and runs under win32. When I try to compile the project under x64, I get nothing, and everything gets 'skipped'. Furthermore, when I try to get the properties of anything under the 64 bit version, the operation fails with an 'unspecified error'. On the 64 bit side, I can switch to the win32 build target, watch it work, and then try to switch to the x64 bit side, and then clench my teeth in frustration. If I try to do a batch build for every configuration, again, total failure unless I just do win32 projects.
I've seen this project work on someone else's machine, so I know that it works in 64 bits, but for some strange reason, this project just doesn't work for me.
I've tried to run
devenv /resetskippkgs
as per this suggestion here, but there's no love.
Any help is appreciated...
EDIT from Pavel's suggestion, I tried to run using
vcbuild /platform:x64
and I get the error:
vcbuild.exe : warning VCBLG6001: Project 'project.proj' does not support platform
'x64', or the platform support DLL for this platform is not installed.
That help? Does visual studio not automatically Do The Right thing when installed?
The solution! Posted because I lost so much time to this, and I'd hope that someone else does not similarly lose time (otherwise, I'd just delete the question).
Apparently, the visual studio 2008 installer declined to install the x64 compiler tools by default on my machine. I don't know if that's because I'm on an AMD machine and there's some question about running on that processor, or just someone made a mistake, or what, but once I checked what had been installed by visual studio, I found the glaring red 'x' indicating that the x64 compiler was not installed. ARM, yes, x64, the processor I'm using, no.
So, adding that processor option back seems to have restored the universe to its rightful place.
I was using internet based setup (everything downloaded from internet). There is also the same issue here. Everything for x64 seems to be installed but I cannot compile or check properties while I select x64 release or debug solution.
This was because .NET framework 3.5 x64 is not available for Windows XP and it will not install on your Windows XP x64. And apparently you cannot compile any x64 code if you don't have this framework.