Defining a WIN32 preprocessor on a 64-bit Windows platform

Should the preprocessor definition be changed from WIN32 to WIN64 when porting Visual C ++ projects to target 64-bit platforms.

Now I built a project with the following settings

  • MACHINE (Specify the target platform) is installed on /MACHINE:X64 .

  • The target environment is installed on /env x64

  • in the project settings C / C ++ → Code Generation, member Struct Alignment to 8 Bob.

Please tell me what other project settings should I configure to change.

+6
source share
1 answer

Did you mean _WIN32 and _WIN64 macros? If you have specified all the parameters to the right (see PS), you do not need to change your code. In a 64-bit solution, both _WIN32 and _WIN64 must be defined. The _WIN32 macro indicates that you can use the Win32 API and the _WIN64 macro, which defines this compilation for 64-bit mode. You can also use different macros for Itanium (_M_IA64) and x86-64 (_M_AMD64). See MSDN for more information.

PS. Have you chosen the platform parameters manually? You can specify it through VS: 1. Build Menu → Configuration Manager. 2. Select Create in the active solution platform. 3. Enter or select a new platform → x64 and click OK. 4. Now in the line "Platform" you can simply select x64.

+2
source

Source: https://habr.com/ru/post/948376/


All Articles