本文介绍了Xcode 的用户标题搜索路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两条路径希望 Xcode 搜索标头:

I have two paths that I want Xcode to search for headers:

"/myproject/lib1/include"
/myproject/lib2/include"

在 Xcode 的 User Header Search Paths 中添加这两个路径的正确语法是什么?我试过"/myproject/lib1/include";"/myproject/lib2/include"

What's the correct syntax for adding those two paths inside Xcode's User Header Search Paths? I tried "/myproject/lib1/include";"/myproject/lib2/include"

但是没有用.它抱怨找不到 object1.h.object1 位于/myproject/lib1/include

But it didn't work. It complained that object1.h not found. object1 is inside /myproject/lib1/include

我已经将整个/myproject/lib1/include 文件夹和/myproject/lib2/include 文件夹添加到目标项目中.

I already added the whole /myproject/lib1/include folder and /myproject/lib2/include folder into the target project.

推荐答案

你真的把前导/放到了路径中吗?因为那是绝对路径,可能不是您的意思.

Dd you actually put the leading /into the path? Because that's an absolute path and probably not what you mean.

您可以使用 $(SRCROOT) 将相对位置传递给它,这会扩展包含 Xcode 项目文件的目录.

You can pass it the relative location using $(SRCROOT) which expands the the directory containing the Xcode project file.

因此,假设您的项目文件位于 myroject 目录中,您应该将其放在标题搜索路径中:

So, assuming your project file is in the myroject directory you should put this in your header search paths:

$(SRCROOT)/lib1/include
$(SRCROOT)/lib2/include

这篇关于Xcode 的用户标题搜索路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 20:34