How to check if a 64-bit project is being built in Visual Studio using #ifdef
You may easily do it using #define preliminarily defined in the compiler. The following is the code that shows in what mode a project is being built – 32-bit mode or 64-bit mode (AMD64 or Intel 64) or in Itanium mode.
#if defined _M_IX86 cout << _T(" (x86)"); #elif defined _M_X64 cout << _T(" (x64)"); #elif defined _M_IA64 cout << _T(" (Itanium)"); #endif
- Predefined Macros. https://msdn.microsoft.com/en-us/library/b0084kay(v=vs.80).aspx