is it possible to create 64 bit program using a 32 bit OS - c++

i have 32 bit windows 7 and I am using visual studio 2010 express.
Is it possible to create a solution for a 64 bit platform?
If it is possible, how is it done?

If you write managed code and target AnyCPU, the code will be jitted to appropriate assembly for the platform it's executed on
http://www.hanselman.com/blog/BackToBasics32bitAnd64bitConfusionAroundX86AndX64AndTheNETFrameworkAndCLR.aspx
To directly target 64 bit apps from Visual Studio Express, install Windows Software Development Kit (SDK) in addition to Visual C++ Express.
http://msdn.microsoft.com/en-us/library/9yb4317s.aspx

Maybe "How to: Enable a 64-Bit Visual C++ Toolset at the Command Line" at MSDN helps, but it's for VS2010 not express. Basically it's all about having a cross compiler.
Edit: In addition to that, there is also How to: Configure Visual C++ Projects to Target 64-Bit Platforms.

cl64.exe itself is a 32 bit program. It just produces 64 bit code. In Visual Studio create a Win32 project, and create a new target platform in the configuration manager.

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.

Which is the minimum Visual Studio version or edition to develop both for Win32 and Win64?

Our Windows application (developed in Delphi) is shipped in 32-bit and 64-bit editions. Users can write plugins for it. If they target the 32-bit edition, the need to create a 32-bit dll. If they target the 64-bit edition, they need to target a 64-bit dll.
I would like to create a sample application in Visual Studio C++ that can be used as a reference to help hacking it.
I would like that the Visual Studio solution provided as an example is able to have everything in place to compile a sample dll both for Win32 and for Win64.
Which is the minimum (preferably free) Visual Studio C++ edition or version that I need to be able to compile both for Win32 and Win64. I tried with Visual Studio 2010 Express but it does not seem to let you add Win64 as a target platform.
VS2012 Express includes the 64 bit compiler. It is possible to persuade earlier versions of the Express edition to use the 64 bit tools, but it's quite tricky to set up.

How can I configure visual c++ 2008 for 64 bit? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to compile a 64-bit application using Visual C++ 2010 Express?
How can I compile 64 bit with visual c++ 2008
I am trying to compile an application that contains CUDA code. I have visual c++ 2008 express version (the free version) on my computer. To be able to use the cuda compiler I followed the steps from here, here and here. The cuda files (with *.cu extension) now compile fine, but the other normal C++ files are using 32 bit because at the drop box on the top (configuration manager) of IDE, it says Win32. There is no option to make it Win64. What should I do to tell configuration manager to use 64 bit. Note that I have 64 bit compilation tools now that I installed the Windows SDK.
Visual Studio Express 2008 doesn't ship with the x64 compiler, that's reserved for the pro versions.
The command-line version is included in the Windows SDK though, which is available for free. You can find some information about adding the 64bit compiler to Visual Studio Express on the internet, but it's a big hack. Just a quick search on google revealed for example this blog-entry: https://jenshuebel.wordpress.com/2009/02/12/visual-c-2008-express-edition-and-64-bit-targets/
http://msdn.microsoft.com/en-us/library/9yb4317s%28v=vs.90%29.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."
Right click the solution -> Active solution platform -> New... -> x64 (under "Type or select the new platform:)

Compile for x64 with Visual Studio?

Question:
Assume a C++ hello world program, non .NET.
With Visual Studio 2005/2008/2010, how can I compile a 64-Bit application ?
I have a 64 Bit Windows, but by default, VS seems to compile 32 bit executables...
On Linux with g++, I can use -m32 and -m64, but how can I compile a 64 bit solution with Windows ? Is it even possible with 2005 ? Or does one need 2008 or even 2010 Beta, or even some x64 SDK ?
There is a step-by-step instructions by Microsoft: http://msdn.microsoft.com/en-us/library/9yb4317s.aspx
It sounds like it may just be that you haven't set the correct target. It is possible to also build x64 applications on an x86 using the cross compiler tools.

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