在Visual Studio 2010中是否有64位#define?

时间:2011-12-29 20:14:29

标签: c++ c visual-studio-2010

是否有#define指示Visual Studio是否在64位模式下编译?我希望能够有条件地包含一些代码

#ifdef _IS_64BIT
  ...
#else //32 bit
  ...
#endif

我知道我可以自己创建一个标志,但我想知道编译器是否提供了一个标志。

3 个答案:

答案 0 :(得分:48)

#ifdef _WIN64
  ...
#else
  ...
#endif

记录在MSDN

答案 1 :(得分:9)

使用_WIN64。 64位处理器的类型无关紧要。

答案 2 :(得分:3)

#ifdef WIN32#ifdef _WIN32将在x64中有效。