【发布时间】:2011-03-04 09:10:17
【问题描述】:
如何获得 POSIX strerror_r 而不是 GNU 版本?
我在 Ubuntu 8.04 上使用 g++ 和 glibc 2.7 版进行编译(基于其中的内容)。
编辑
在上面的手册页上写着:
glibc 的功能测试宏要求(参见 feature_test_macros(7)):
The XSI-compliant version of strerror_r() is provided if:
(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE
Otherwise, the GNU-specific version is provided.
If no feature test macros are explicitly defined, then the following feature
test macros are defined by default: _BSD_SOURCE, _SVID_SOURCE, _POSIX_SOURCE,
and _POSIX_C_SOURCE=200809L (200112L in glibc versions before 2.10; 199506L in
glibc versions before 2.4; 199309L in glibc versions before 2.1).
所以我应该得到 POSIX 版本,但我得到的是 GNU 版本。
【问题讨论】:
-
您确定没有任何头文件或 3. 派对头文件定义例如
_GNU_SOURCE?