小编Gua*_*Zhu的帖子

为什么我在Ubuntu上得到函数'open64'/'openat'/'openat64'的隐式声明?

gcc 4.8.2

#define __USE_FILE_OFFSET64
#define __USE_LARGEFILE64
#include <fcntl.h>

int
main(void) {
    int fd = open64("/", O_RDONLY);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

然后gcc的输出是'warning:隐式声明函数'open64'[-Wimplicit-function-declaration]'.但是在fcntl.h中:

#ifndef __USE_FILE_OFFSET64
extern int open (const char *__file, int __oflag, ...) __nonnull ((1));
#else
# ifdef __REDIRECT
extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64)
     __nonnull ((1));
# else
#  define open open64
# endif
#endif
#ifdef __USE_LARGEFILE64
extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1));
#endif
Run Code Online (Sandbox Code Playgroud)

即使添加了#define __USE_ATFILE,函数openat/openat64也会遇到同样的问题.我不知道这些发生了什么.

c linux gcc

2
推荐指数
1
解决办法
868
查看次数

标签 统计

c ×1

gcc ×1

linux ×1