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

查看:83
本文介绍了在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天全站免登陆