Is there an option to specify in MSVC 2010 commandline executable to force the 32-bits compilation? If so, what is it?
Thanks by advance force your help,
Regards.
Commandline for compiling 32bit needs an additional /D "WIN32"
This will simply define WIN32
. Macros like INT_PTR
will be interpreted differently for 64-bit versus 32-bit. For example, INT_PTR
is defined as follows:
#if defined(_WIN64)
typedef __int64 INT_PTR, *PINT_PTR; //64bit
...
#else
typedef _W64 int INT_PTR, *PINT_PTR; //32bit
...
#endif
In addition, the link option for 64-bit includes /MACHINE:X64
For 32-bit it must be changed to /MACHINE:X86
In Visual Studio you can create a sample project, then in Project Properties it shows commandline option for C/C++ compile and link.