Portál AbcLinuxu, 12. května 2025 08:00
make gcc -std=c99 -pedantic -Wall -W -g -c linux.c linux.c: In function ‘main’: linux.c:26: error: ‘S_IFMT’ undeclared (first use in this function) linux.c:26: error: (Each undeclared identifier is reported only once linux.c:26: error: for each function it appears in.) linux.c:27: error: ‘S_IFBLK’ undeclared (first use in this function) linux.c:28: error: ‘S_IFCHR’ undeclared (first use in this function) linux.c:29: error: ‘S_IFDIR’ undeclared (first use in this function) linux.c:30: error: ‘S_IFIFO’ undeclared (first use in this function) linux.c:31: error: ‘S_IFLNK’ undeclared (first use in this function) linux.c:32: error: ‘S_IFREG’ undeclared (first use in this function) linux.c:33: error: ‘S_IFSOCK’ undeclared (first use in this function) make: *** [linux.o] Error 1Vsechny tyto konstanty by se podle me meli nachazet v /sys/stat.h knihovne, ta je vsak v programu includovana (viz onen exapmle z dokumentace). Co je tedy spatne?
-std=c99
. Nicméně proč zrovna to vadí nevím.
POSIX does not describe the S_IFMT, S_IFSOCK, S_IFLNK, S_IFREG, S_IFBLK, S_IFDIR, S_IFCHR, S_IFIFO, S_ISVTX bits, but instead demands the use of the macros S_ISDIR(), etc. The S_ISLNK() and S_ISSOCK() macros are not in POSIX.1-1996, but both are present in POSIX.1-2001; the former is from SVID 4, the latter from SUSv2.Použijte buď std=gnu99 nebo si zjistěte, kde jsou definována ta POSIXová makra a použijte ta.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.