MacOS X 中未定义宏“__unix__”
我注意到在 MacOS X (Lion) 中,宏 __unix__ 未定义。 既然 MacOS 起源于 BSD UNIX,那么情况不应该如此吗?
是否可以让编译器/预处理器知道我希望它被视为 UNIX 系统?
I noticed that in MacOS X (Lion), the macro __unix__
is not defined.
Since MacOS has its roots in BSD UNIX, shouldn't that be the case?
Is it possible to let the compiler/preprocessor know that I want it to be considered a UNIX system?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为此网站提供最全面的答案。
简而言之,要包含 Apple 平台和常见的 Unix 平台,您需要:
I think this site gives the most comprehensive answer.
In short, to include Apple platforms and common Unix platforms, you'll need:
预定义宏站点建议使用:
区分 UNIX 系统。他们还对许多未设置任何这些的编译器提供了警告注释。根据您关心平台的原因,您最好查看配置时间(在
configure.ac
或您正在使用的任何构建系统中)。The predefined macros site suggests using:
To distinguish UNIX systems. They also have warning notes about a number of compilers that don't set any of these. Depending on why you care about what the platform is you might be better off looking at configure time (in
configure.ac
or whatever build system you're using).