VS2010中未定义的_AMD64_ [英] _AMD64_ not defined in VS2010

查看:355
本文介绍了VS2010中未定义的_AMD64_的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS2010中创建了一个新的c ++项目。我添加了x64作为新的解决方案平台。我尝试将复制设置自设置为 Win32和空,但均无效。当我选择x64作为平台时,未定义 _AMD64 _ 。不是吗我是否还不知道要针对64位进行编译的另一步骤?

I created a new c++ project in VS2010. I added x64 as a new solution platform. I tried setting "copy settings from" to both "Win32" and "empty", but neither worked. _AMD64_ is not defined when I select x64 as the platform. Shouldn't it be? Is there another step I am unaware of for compiling for 64 bit?

期待一些问题:我使用的是VS2010 Ultimate,在VS期间选择了Windows 7 64位,x64编译器

In anticipation to questions: I am using VS2010 Ultimate, Windows 7 64bit, x64 compilers were selected during VS installation.

推荐答案

您已正确完成所有步骤。 Visual Studio默认情况下未预定义 _AMD64 _ 符号。如果要使用它,则需要自己定义:

You've got all the steps right. An _AMD64_ symbol is not predefined by default by Visual Studio. You'll need to define it yourself if you want to use it:

#if defined _M_X64 || defined _M_AMD64
    #define _AMD64_
#endif

纪念它的存在。 Windows DDK附带了一些定义此符号的makefile文件。检入 makefile.def 。可能是:

But you're not making up the memory of its existence. The Windows DDK comes with makefiles that define this symbol, in addition to some others. Check in makefile.def. The possibilities are:


  • _X86 _

    分别称为x86,i386和IA-32

    (与VS的预定义 _M_IX86 相同)

_AMD64 _

也称为AMD64,x64,x86-64,IA-32e和Intel 64

(与VS的预定义 _M_X64 _M_AMD64 相同)

_IA64 _

Intel Itanium(IA-64)

(这是与VS的预定义 _M_IA64

&hellip相同;还有一些其他针对无人针对的架构的

…and some others for architectures nobody targets anymore

理想情况下,您可以将构建系统配置为预定义一组已知的宏,然后在自己的代码中使用它们。如果您没有构建系统,请至少在预编译的头文件中进行设置。这样,您就不再依赖于依赖于实现的符号无处不在,并且切换编译器也不是一件繁琐的事情,例如,由GCC预定义的目标体系结构符号与MSVC完全不同。

Ideally, you would configure your build system to predefine a set of known macros that you will then use in your own code. If you don't have a build system, at least set something up in a precompiled header file. That way, you're not relying on implementation-dependent symbols everywhere, and switching compilers is not a colossal chore—the target architecture symbols predefined by GCC are very different from MSVC, for example.

这篇关于VS2010中未定义的_AMD64_的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆