macos 在 OSX 10.6 上为 C++ 应用程序的默认构建定义的 __LP64__ 在哪里?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6721037/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where is __LP64__ defined for default builds of C++ applications on OSX 10.6?
提问by Dan Nissenbaum
I am building a 3rd-party library in 32-bit mode on OSX 10.6 (the library is Xerces 2.8). I have determined that the preprocessor definition __LP64__
is set. However, as far as I can see it is not being set within any configuration files of the 3rd-party project, and doing a global search through all files (via the Finder) for #define __LP64__
does not reveal to me where this is being defined by the system.
我正在 OSX 10.6 上以 32 位模式构建一个 3rd 方库(库是 Xerces 2.8)。我已经确定__LP64__
设置了预处理器定义。但是,据我所知,它没有在 3rd-party 项目的任何配置文件中设置,并且对所有文件(通过 Finder)进行全局搜索#define __LP64__
并没有向我揭示这是由系统。
I am building the library via make
at the command line (Xcode is not involved).
我正在通过make
命令行构建库(不涉及 Xcode)。
I would like to know where __LP64__
is defined - and what its purpose is, given that I am building the project in 32-bit mode.
我想知道在哪里__LP64__
定义 - 以及它的目的是什么,因为我正在以 32 位模式构建项目。
回答by Jonathan Grynspan
It's defined automatically by the compiler rather than in any header. If it's set, you're building for 64-bit targets.
它是由编译器自动定义的,而不是在任何头文件中。如果已设置,则您正在为 64 位目标构建。
(A header coulddefine it if the compiler hasn't already, though it shouldn't. If you think this is the case, add #define __LP64__
to your code, and look at the error during preprocessing to determine the location of the previous define.)
(如果编译器还没有定义它,则标头可以定义它,尽管它不应该。如果您认为是这种情况,请添加#define __LP64__
到您的代码中,并在预处理期间查看错误以确定前一个定义的位置。)