简体   繁体   English

多个目录中的`dirent.h`

[英]`dirent.h` in multiple directories

I searched dirent to find C routines我搜索了dirent以找到 C 例程

find / -iregex ".*/dirent.h$" 2>/dev/null

Which return series of identical ones哪个返回系列相同的

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/dirent.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/dirent.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/dirent.h
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/dirent.h

How could I ensure which dirent.h is the one my program invoke?我如何确保哪个dirent.h是我的程序调用的那个?

If you get the compiler to show you the code after pre-processing, you should be able to work it out.如果你让编译器在预处理后向你展示代码,你应该能够解决它。

So, for example, with gcc , you can write a nominal program.c :因此,例如,使用gcc ,您可以编写一个名义上的program.c

#include <dirent.h>
main(int argc, char **argv){
    return 0;
}

And then run:然后运行:

gcc -E program.c

and study what it includes.并研究它包括什么。

Related useful info here .相关有用信息在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM