c 语言 隐式声明,C警告:函数’fchmod’的隐式声明

巧合的是,feature_test_macros(7)联机帮助页直接回答了您的问题:

Specification of feature test macro requirements in manual pages

When a function requires that a feature test macro is

defined, the manual page SYNOPSIS typically includes a note

of the following form (this example from the chmod(2) manual

page):

#include

int chmod(const char *path, mode_t mode);

int fchmod(int fd, mode_t mode);

Feature Test Macro Requirements for glibc (see

feature_test_macros(7)):

fchmod(): _BSD_SOURCE || _XOPEN_SOURCE >= 500

The || means that in order to obtain the declaration of

fchmod(2) from , either of the following macro

definitions must be made before including any header files:

#define _BSD_SOURCE

#define _XOPEN_SOURCE 500 /* or any value > 500 */

Alternatively, equivalent definitions can be included in the

compilation command:

cc -D_BSD_SOURCE

cc -D_XOPEN_SOURCE=500 # Or any value > 500

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值