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

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

Related

Can't change Windows SDK version in Visual Studio C++ project

I have a Visual Studio C++ console application that I created with Visual Studio 2015 and now I can't compile it (with Visual Studio 2017) because it is targeting the Windows 8.1 SDK, which is not installed. The problem is that I can't retarget the project to the Windows 10 SDK.
What happens is that when I open the project properties page and go to General - Target Platform I see the Windows 10 SDK in the dropdown, and I am able to select it... but as soon as I press Apply, it reverts back to 8.1 by itself. No error message is provided.
Visual Studio installer says that, indeed, the listed SDK version is installed:
So what's going on here? Is there a way to retarget my project without having to install the Windows 8.1 SDK?
Not sure if that matters but: this project is actually just a "wrapper" around an existing bare project consisting of just a bunch of .cpp and .h files, which was developed by another person. I'm really not familiar with C++ development.
After hours of struggling with this problem, I coincidentally discovered that selecting Project Properties/General, changing "Platform Toolset" to v141_xp (instead of v141) forcibly drops the Windows SDK Version to 8.1 or 7.0. I'm not sure how Visual Studio chooses which SDK to use.
EDIT: You must edit .vcxproj and change both:
<TargetPlatformVersion>10.0.17134.0</TargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>

Can't install missing features on Visual Studio 2015 on Windows 10

I'm working with cocos2d-x framework for c++ using Visual Studio 2015 Community on Windows 10.
When I try to open a solution for a created project, visual studio says some projects are unavailable. When I right click and go to "install missing feature(s)", visual studio says I have to install "Windows XP support for C++".
When I click to install I get a "Setup - Usage" window(that seems to be bigger than my screen). I don't see any button, so I hit enter, but nothing happens. Nothing downloads and nothing installs...
Does anyone have a solution to this?
The message is as follows:
Install Windows XP support for C++
Windows 7.1 SDK for targeting Windows XP
The following projects will not be loaded unless you install the above
feature
All that's needed is to add in Windows XP Support via the installation tool accessible from Control Panel. Steps:
Close Visual Studio 2015
Open Control Panel
Select 'Programs and Options'
Right click on 'Microsoft Visual Studio Professional 2016'
Select 'Change' from the menu (the only option)
Once the installation tool has set up, select 'Modify'
Expand Programming Languages --> Visual C++
Select 'Windows XP Support for C++'.
Proceed with the update.
Note that selecting 'Windows XP Support for C++' automatically selects its dependencies, 'Windows 8.1 SDK and Universal CRT SDK' and 'Common Tools for Visual C++ 2015'.
What I think might have happened for the OP was that in selecting Universal Windows App Development Tools and various C++ options, they hit upon 'Windows XP Support for C++' itself or something that had it as a dependency. So they may have various components installed unnecessarily now. :-(
got your point.
Here are the steps to install it properly.
Go to the below site and try to install it. & select the option as per the snapshot attached here.
https://www.microsoft.com/en-us/download/details.aspx?id=53587
Also, if required, please refer to the below blog.
https://devblogs.microsoft.com/cppblog/setup-changes-in-visual-studio-2015-affecting-c-developers/

How to compile C++ for Windows with clang in Visual Studio 2015

As far as I understand, Visual Studio 2015 is shipped with clang. First I though this was only for Android and iOS apps, but according to this article it should also be possible to use the clang++ frontend for Windows programs. However, I can't find the according option.
So could you please explain to me, how I can change the used compiler to clang in a c++ project (in VS2015 RC Community Edition).
Starting with VS2015 Update 1 you can install the "Clang with Microsoft CodeGen" template via the New Project window, browse to Installed -> Templates -> Visual C++ -> Cross Platform.
You will then be able to choose the Clang 3.7 with Microsoft CodeGen v140_clang_3_7 Platform Toolset in the properties page of any Windows C++ project.
Clang has a completely different set of command-line options which it recognizes, so when using the v140_clang_3_7 toolset, the project properties must be using Clang-compatible options, which can be recognized as starting with - instead of /. For example, Debug Information Format property set to "Full Debug Information (DWARF2) (-g2 -gdwarf-2)", and Enable C++ Exceptions property set to "Yes (-fexceptions)".
There's more information in this blog post.
As far as I understand it both Clang and GCC are shipped with the Android and iOS crossplatform SDKs/tools for Visual Studio 2015.
From what I've seen it only allows me to choose those while having one of those crossplatform projects.
Using the template project for a GLES C++ application you get the following options:
While for a Windows C++ application you get the dialog below where you can see that Windows target platform is grayed out and read-only, meaning you probably have a set of toolkits for each target platform, but you simply cannot change it, at least for now.
Have no idea how you turn a normal VS project into crossplatform though, and it's likely that you can only target Android or iOS out of the box using 3rd party compilers.
It may be possible, though, to install Clang as another toolkit in the same way the XP toolkits are. So perhaps it's just a matter of someone fiddling with it and making it available as it is already installed.
Caveat: This answer is pre-VS2015 update 1 which didn't have the "Clang with Microsoft CodeGen" option.
After reading through the linked post and especially the comments again, I came to understand, that this is not a feature shipped with VS2015 RC but a possible future feature that might e.g. be shipped in a SP or (more likely) with the next version of VS.
As mentioned by sjdowling, the closest thing you can do at the moment (October 2015, clang 3.7) is to download and install llvm for windows. This should give you a LLVM-vs2014 platform toolset option. For me it works for simple test programs, but apparently this version of "clang-vs" seems to not yet support exceptions. However, according to these notes, that problem should be mostly solved for clang 3.8.
While the above solutions work they require that you have installed clang which is off by default in the visual studio 2015 installation. The accepted answer does show how to install it, though the next page will ask you to close visual studio which you are running the new project from.
If anyone is wondering how to install clang because it does not show up in their list here is another solution:
Control Panel->Programs->Programs and Features.
Right click on “Microsoft Visual Studio Enterprise 2015” (or
“Microsoft Visual
Studio 15 Preview” if you have the preview of the next version of
Visual Studio installed)
Click “Change”
Click “Modify”
Select “Clang with Microsoft CodeGen” – The March 2016 release.
https://blogs.msdn.microsoft.com/vcblog/2016/03/31/clang-with-microsoft-codegen-march-2016-released/

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

visual studio 2008 C++ no x64 platform

I installed Visual Studio 2008 on my Windows 7 x64 laptop together with installation of Service Pack 1.
Now I want to add x64 platform to my C++ solution. But there is no x64 platform available in the configuration manager for my project. I'm sure I manually selected x64 support during the Visual Studio installation and it was installed.
What is wrong with my setup?
If I recall, VS 2008 Pro doesn't install the 64-bit compiler and tools by default. You have to explicitly select them during the installation.
Control Panel -> Uninstall Programs.
Select Visual Studio and click Uninstall/Change.
Wait. Wait some more. Click Next.
Choose Add or Remove Features.
Expand MSVC 2008 -> Language Tools -> Visual C++.
Select X64 Compilers and Tools.
You'll probably need your original installation media.
Once the 64-bit compiler and tools are installed, you should be able to add a 64-bit configuration to your solution.
See "Use Visual Studio to build 64-bit application" for all you need to build x64 apps with Visual Studio 2008.
Visual Studio 2008 only comes with x64 compiler with the Professional editions and higher. You can download the free Windows SDK from MSDN to get the x64 compiler.
If your projects don't have the x64 configuration, just add that configuration via the configuration manager. I don't remember if 2008 created the x64 configuration by default but I suspect not.
I also seem to remember that you can just add the x64 configuration to the solution and it will prompt on whether or not to add it to all of the contained projects but my memory is rusty on that one.
Regardless, once you've got the configurations added, you'll need to modify anything you'd modified before in project settings. Output paths, library dependencies, etc. The New Configuration "Wizard" is pretty dumb.