>
>
How to check if a 64-bit project is bei…

Andrey Karpov
Articles: 643

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

References