Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation fails with -std=c99 #29

Closed
cxong opened this issue Mar 31, 2016 · 1 comment
Closed

Compilation fails with -std=c99 #29

cxong opened this issue Mar 31, 2016 · 1 comment

Comments

@cxong
Copy link
Owner

cxong commented Mar 31, 2016

/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.

@cxong cxong closed this as completed in b37e393 Mar 31, 2016
@cxong
Copy link
Owner Author

cxong commented Mar 31, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant