- 论坛徽章:
- 0
|
我写了个小程序,中间有如下的代码行:
fd=open(argv[1],O_RDONLY|O_NOATIME);
编译的时候总是报错
[root@localhost 03-cap_fowner]# gcc -o test test.c
test.c: In function 'main':
test.c:23: error: 'O_NOATIME' undeclared (first use in this function)
test.c:23: error: (Each undeclared identifier is reported 'O_NOATIME'only once
test.c:23: error: for each function it appears in.)
应该是不认识'O_NOATIME'这个常量
我在程序中定义了:
#define __USE_GNU 1
也引用了:
#include <fcntl.h>
在编译的时候加上选项:
[root@localhost 03-cap_fowner]# gcc -o test test.c -D__USE_GNU
test.c:1:1: warning: "__USE_GNU" redefined
<command line>:1:1: warning: this is the location of the previous definition
test.c: In function 'main':
test.c:23: error: 'O_NOATIME' undeclared (first use in this function)
test.c:23: error: (Each undeclared identifier is reported only once
test.c:23: error: for each function it appears in.)
结果还是一样的错!
请指教一下这是怎么弄的阿!??
我的系统是RHEL 5.1 gcc版本 :4.1..2 |
|