MacOS X 中未定义宏 `__unix__` [英] Macro `__unix__` not defined in MacOS X

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

问题描述

我注意到在 MacOS X (Lion) 中,宏 __unix__ 没有定义.既然 MacOS 源于 BSD 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?

是否可以让编译器/预处理器知道我希望它被视为 UNIX 系统?

Is it possible to let the compiler/preprocessor know that I want it to be considered a UNIX system?

推荐答案

预定义宏站点建议使用:

#if defined(unix) || defined(__unix__) || defined(__unix)
# define PREDEF_PLATFORM_UNIX
#endif

区分 UNIX 系统.他们也有关于一些没有设置任何这些的编译器的警告说明.根据您关心平台的原因,您可能最好查看配置时间(在 configure.ac 或您正在使用的任何构建系统中).

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).

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

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