如何处理;警告:内联函数“*stat64”已声明但从未定义;在支持gnu99的gcc中
我在我的如何处理;警告:内联函数“*stat64”已声明但从未定义;在支持gnu99的gcc中,c,linux,gcc,stat,gnu99,C,Linux,Gcc,Stat,Gnu99,我在我的foo.c中包括stat.h,如下所示: #include <sys/stat.h> gcc -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O0 -g -Wformat -Wall -Wswitch-enum -Wextra -std=gnu99 -DDEBUG=1 -c foo.c -o objects/foo.o -I... gcc -D_FILE_OFFSET_BITS=
foo.c
中包括stat.h
,如下所示:
#include <sys/stat.h>
gcc -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O0 -g -Wformat -Wall -Wswitch-enum -Wextra -std=gnu99 -DDEBUG=1 -c foo.c -o objects/foo.o -I...
gcc -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O0 -g -Wformat -Wall -Wswitch-enum -Wextra -std=gnu99 -DDEBUG=1 objects/foo.o -o ../bin/debug.foo ../lib/libfoo.a ... -lbz2 -lz
我收到以下警告,这些警告特定于
功能:
In file included from foo.c:15:0:
/usr/local/gcc-4.7.2/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/include-fixed/sys/stat.h:317:16: warning: inline function `lstat64` declared but never defined [enabled by default]
/usr/local/gcc-4.7.2/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/include-fixed/sys/stat.h:255:16: warning: inline function `fstat64` declared but never defined [enabled by default]
...
如何修复这些警告中引用的问题?在我使用
-std=gnu99
迁移到C99支持之前,这似乎不是一个问题,但我不知道为什么。感谢您的建议。添加标志可以通过启用“C99模式下内联函数的传统GNU语义”来修复警告。问题中的代码确实使用lstat()
?它使用stat()
。相关的代码行是struct stat buf;int i=状态(fn和buf)代码>