I think this is a trivial question, but I just don’t know why.
When clang compile the following snippets, it complains that there is no definition for ‘lstat’.
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
int main(int argc, char** argv) {
assert(argc > 1);
struct stat buf;
stat(argv[1], &buf);
printf("%u\n", buf.st_mode);
lstat(argv[1], &buf);
printf("%u\n", buf.st_mode);
return 0;
}
However it compiles without any warnings when using gcc, and I can see the declaration of lstat in sys/stat.h.
Is it because the certain macro definition hides the declaration of lstat when compiling using clang?
The clang version is 3.4 svn186209 and I’m on an x86_64 machine running on Ubuntu 12.04 LTS.
Thanks,
Hongxu Chen