Compilation fails with -std=c99
cxong opened this issue · comments
Cong commented
/home/cxu/test/tinydir/samples/../tinydir.h: In function ‘tinydir_open’:
/home/cxu/test/tinydir/samples/../tinydir.h:212:10: error: implicit declaration of function ‘readdir_r’ [-Werror=implicit-function-declaration]
error = readdir_r(dir->_d, dir->_ep, &dir->_e);
^
/home/cxu/test/tinydir/samples/../tinydir.h: In function ‘_tinydir_dirent_buf_size’:
/home/cxu/test/tinydir/samples/../tinydir.h:654:13: error: #error "buffer size for readdir_r cannot be determined"
# error "buffer size for readdir_r cannot be determined"
^
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/file_open_sample.dir/file_open_sample.c.o] Error 1
make[1]: *** [CMakeFiles/file_open_sample.dir/all] Error 2
make: *** [all] Error 2
In particular, the _tinydir_dirent_buf_size
function needs fixing as it is relying on preprocessor flags that haven't been defined like HAVE_FPATHCONF
.
Cong commented
Should have RTFM... http://linux.die.net/man/3/readdir_r
readdir_r
requires various feature macros to be set, as it is a POSIX rather than a standard C function.