How to deal with "warning: inline function `*stat64` declared but never defined" in gcc with gnu99 support
c, gcc, gnu99, linux, stat
Solution
Adding the `-fgnu89-inline` flag fixes the warnings, by enabling "traditional GNU semantics for inline functions when in C99 mode".
Problem
I am including `stat.h` in my `foo.c` as follows: ``` #include <sys/stat.h> ``` When I compile this as follows: ``` 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 ``` I get the following warnings, which are specific to `<sys/stat.h>` functions: ``` 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] ... ``` How would I fix the issue referenced in these warnings? This didn't seem to be an issue until I migrated to C99 support with `-std=gnu99`, but I'm not sure why. Thanks for any advice.