22

I'm using Visual Studio for c++ programming, and after working and writing programs in x86 environment (32bit Mode) I tried to build my x86 project in x64 environment so I thought that I should create a win64 console project instead of win32 console project but there were not such as an option in VC2010 . so I want to ask that for building x64 projects I should also choose win32 project and change the settings for compiling in x64 inside the project using instruction in here?

I'm using windows 7 64bit.

if your answer is yes then why it is called win32?

Community
  • 1
  • 1
PsP
  • 696
  • 3
  • 10
  • 34
  • 4
    Win32 can refer to the 32-bit or 64-bit API. Most of it is the same. – chris Jul 11 '13 at 19:02
  • 9
    It's called `win32` for the same reason people still "dial" telephone numbers. That is, it is a carryover from when it made sense to call it that. When win32 came along, it was named to distinguish it from plain 16-bit Windows. At the time, 32-bit architectures in a PC was a mindblowing advance. – wallyk Jul 11 '13 at 19:08
  • possible duplicate of [Should I define both \_WIN32 and \_WIN64 in 64bit build?](http://stackoverflow.com/questions/6679396/should-i-define-both-win32-and-win64-in-64bit-build) – Hans Passant Jul 11 '13 at 19:26
  • 1
    The name dates back to Windows 3.11 and Windows NT 3.x. Before that, the existing API was a 16/32 bits hybrid. It had many complex rules about "locking pointers" and "segments", all of which are gone in Win32. – MSalters Jul 12 '13 at 07:57
  • If Win32 can refer to either 32-bit or 64-bit, how does it make sense as a platform target in Visual Studio? – Kyle Delaney Jun 12 '17 at 16:17
  • reading this thread am I still don't get why visual studio 2017 c++ windows desktop and windows universal project templates use "Win32" as the platform target name for "x86" build output. When you switch to the c# windows desktop and windows universal project templates they all use "x86" as the platform target for "x86" build output. Even more confusing is the c++ project template output directory and intermediate directory settings where they use different macro based path settings for "Win32" than they do for ARM, ARM64 and x64 where the latter all use the same settings. – myusrn Nov 16 '18 at 16:43

3 Answers3

15
  • "Win32" is the name of the OS API.
  • "Win32 Console Application" got its name from the API (not from bit-ness).

Win32 API can be used both by 32-bit and by 64-bit applications. So, a Win32 Console Application can be built both for 32-bit and for 64-bit. For the latter, create the "x64" configuration in the Configuration Manager.

Branko Dimitrijevic
  • 50,809
  • 10
  • 93
  • 167
  • 5
    Exactly. _Win32 API_ [is a synonym](http://msdn.microsoft.com/en-us/library/vstudio/bb384843.aspx) for _Windows API_. Now that we are in a 64bit world, the shortening of _Win32 API_ to _Win32_ is a particularly misleading term. – Rian Rizvi Nov 04 '13 at 17:19
6

The other answers pretty much have it covered, but I thought I might add the following clarifications:

X86 is for Intel/AMD's 32 bit chip set. Win32 can support other chipsets, such as ARM in a Windows Mobile project.

Furthermore, when building native c++ applications for x86, the platform will actually be called win32.

James John McGuire 'Jahmic'
  • 11,728
  • 11
  • 67
  • 78
  • 1
    If Win32 can refer to a 32-bit or a 64-bit platform, isn't it misleading for Visual Studio to use Win32 to refer to a 32-bit platform? – Kyle Delaney Jun 12 '17 at 16:19
  • @KyleDelaney. I think your comment might be intended for another answer. But I'll add my thoughts in any case... By default, Win32 does only refer to 32-bit platforms, not 64. However, you can mangle and (mis)configure the settings, so it does somehow apply to 64 bit platforms. Then, there is the point that people still use the term 'Win32', when they talking about the API set (regardless of the actual platform). – James John McGuire 'Jahmic' Jun 13 '17 at 16:13
0

I think there is a confusion here, tell me if I am wrong, but you're basically have problems setting up your console program to the x64 platform.

If you're using the express version you will need to install a proper Microsoft Windows SDK for Windows 7 and .NET Framework 4 and SP1, as stated on the link you provided otherwise the x64 platform option won't be available. Have you already done this?

Once done this, switching to the x64 will be pretty easy, you will get the option on the dropdown list of the platforms, should compile fine (and no, you don't need to use the win32 configuration).

notNullGothik
  • 432
  • 5
  • 20
  • No I've got no problem in setting my environment to x64 platfrom. but thanks for your comment – PsP Jul 11 '13 at 20:26