필자가 쓰는 일부 C 코드에 이상한 문제가 발생했습니다. 다음 코드를 고려하십시오 POSIX.1-2008, 헤더 파일 <에서 sys/stat.h에 따르면sys/stat.h가 -std = c1x 인 ino_t를 정의하지 않는 이유는 무엇입니까?
#include <sys/stat.h>
ino_t inode;
을 >는 ino_t
1 정의
< SYS /stat.h > 헤더는
blkcnt_t
,blksize_t
, 0123을 정의해야합니다. 179,,ino_t
,mode_t
,nlink_t
,uid_t
,gid_t
,off_t
및time_t
유형 <SYS/types.h>에 기재된.
내 리눅스 시스템의 파일에 TEST.C을 장소 위의 소스 코드를 컴파일 할 때이 문제가 발생 :
내가 어떤을 지정할 때ino_t
의 정의 revelead하지 왜
$ cat test.c #include <sys/stat.h> ino_t inode; $ uname -srm Linux 3.8.0-26-generic x86_64 $ lsb_release -d Description: Ubuntu 13.04 $ gcc -c test.c $ gcc -std=c90 test.c test.c:2:1: error: unknown type name 'ino_t' $ gcc -std=c99 test.c test.c:2:1: error: unknown type name 'ino_t' $ gcc -std=c1x test.c test.c:2:1: error: unknown type name 'ino_t'
-std 옵션은 무엇입니까?
아하. 방금 200809L에 _POSIX_C_SOURCE를 정의하는 것 또한 트릭을 수행한다는 것을 알았습니다. – fuz
'man feature_test_macros' –
@R .. 아직 찾을 수 없기 때문에 힌트가 더 필요합니다. –