【问题标题】:`dirent.h` in multiple directories多个目录中的`dirent.h`
【发布时间】:2019-04-13 20:59:43
【问题描述】:

我搜索dirent找到C例程

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

返回相同的系列

/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

如何确保我的程序调用的是哪个dirent.h

【问题讨论】:

    标签: c macos


    【解决方案1】:

    如果您让编译器在预处理后向您显示代码,您应该能够解决它。

    因此,例如,使用gcc,您可以写一个名义上的program.c

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

    然后运行:

    gcc -E program.c
    

    并研究其中包含的内容。

    相关有用信息here

    【讨论】:

      猜你喜欢
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-30
      • 2012-04-14
      • 1970-01-01
      • 2010-10-23
      • 1970-01-01
      相关资源
      最近更新 更多