gpt4 book ai didi

objective-c - #import 如何在 Objective-C 中搜索文件

转载 作者:搜寻专家 更新时间:2023-10-30 20:07:55 25 4
gpt4 key购买 nike

我只能找到一点关于该主题的信息。我现在的理解是

#import <my.h> // searches in the system paths
#import "my.h" // searches in the same dir as the source file - is that right?

我有一个静态库,其中的 .h 文件位于不同的位置。我可以让编译器像在 VC++ 中那样使用#import "my.h"搜索 .h 文件的新文件夹吗

最佳答案

除了#import "my.h",你的理解几乎是正确的在与源文件相同的目录中搜索,所有系统路径(与 #import <my.h> 搜索的相同)。

I have an static library with .h files in a different location. Can I have the compiler search a new folder for .h files with #import "my.h" like I would in VC++

是的。你必须通过 -I标记为 gcc。例如,如果您要搜索 path/to/my-other-dir ,你会通过 -Ipath/to/my-other-dir海湾合作委员会。如果您使用的是 Xcode,则可以使用目标的构建选项对其进行配置;在搜索路径下寻找名为标题搜索路径的选项。

关于objective-c - #import 如何在 Objective-C 中搜索文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2774358/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com