Compile for x64 with Visual Studio? - c++

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.

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.

can i build c++ code for different platforms(like stm32 ARM processor) in visual studio 2012

Can i compile a c++ code in visual studio 2012 IDE which will be ultimately run on a stm32 ARM processor. Because i think visual studio is the best when it comes to IDE in the current time. Thanks in advance.
Yes if you buy the right tools. There are two that I know of: WinGDB at http://www.wingdb.com/
and VisualGDB at http://visualgdb.com/. Looks like they will let you use Visual Studio and use either a GCC cross-compiler or GCC running on a remote to do the actual compilation.
Yes and no. Visual Studio can target multiple Windows platforms, including Windows on ARM. But it can't target Linux on ARM, which is by far the most common.

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.

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

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.

How can I compile c++ on (64bit) windows to make a 64bit exe?

Using the g++ compiler that came with code::blocks I can compile 32bit programmes but when I try to compile to a 64bit programme it tells me that 64 bit isn't implemented, even though I have 64bit os.
How can I compile c++ to make a 64bit exe?
Download Microsoft Visual C++, and set the target to 64-bit.
Why make programming harder than it needs to be?
If you are not limited to gcc, you can use Microsoft's compiler from Visual Studio Express 2010 with Windows SDK (both are free) and you can configure Visual C++ Projects to Target 64-Bit Platforms
Download the 64-bit version of gcc, or recompile it yourself with 64-bit support.
I think mingw comes with a version of gcc that can compile 64-bit binaries.
Code:Blocks supports Visual Studio as the compiler, you can download it here http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express, also the fact you have a 64 bit OS has got nothing to do with whether you can compile 64 but code, it even has nothing to do with the CPU architecture, think about it, you can compile Android code in Linux, OSX and Windows and you are not running on an ARM CPU. The Code:Blocks page tells you how to configure it to use the MS compiler.
If you want the 64 bit compiler you need to install either the SDK or the WDK