简体   繁体   English

Mac + Xcode 6.4-标头包含路径

[英]Mac + xcode 6.4 - header include path

So, I have an Xcode project that contains sources which include headers from external library (static one) 因此,我有一个Xcode项目,其中包含源,其中包括来自外部库(静态库)的头

The include is done in common way: 包含以常见方式完成:

 #include <iostream>
 #include <string>
 #include <jsapi.h>

The third line causes compiler error: 'jsapi.h' file not found 第三行导致编译器错误: 'jsapi.h' file not found

Eg: Lexical or Preprocessor issue 'jsapi.h' file not found 例如: Lexical or Preprocessor issue 'jsapi.h' file not found

Now I got that I should add include folder into the project settings. 现在我知道应该在项目设置中添加包含文件夹。 So I opened the projects and into Search Paths category under Header Search Paths I've added /usr/local/include/ where the headers really are. 因此,我打开了项目,并在“ Header Search Paths Search Paths下的“ Header Search Paths Search Paths类别中添加了/usr/local/include/标题所在的位置。 Still same error. 还是一样的错误。 I tried copying them under /Users/.../include/ and pointing there - still same error. 我尝试将它们复制到/Users/.../include/下并指向那里-仍然是相同的错误。

So I tried going through SO and people suggested using User Header Search Paths , did that - still same error. 所以我尝试遍历SO,有人建议使用User Header Search Paths ,这样做-仍然是同样的错误。

Now I know this will be something really dumb, but why Xcode does not search those paths on default (assuming that / means root folder - as for some reason my C headers are under ./Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/ ). 现在我知道这确实有些愚蠢,但是为什么Xcode不会默认搜索那些路径(假设/表示根文件夹-由于某种原因,我的C标头位于./Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/ )。 I could try copying those header files in there, but well ... that just makes more harm than good. 我可以尝试将那些头文件复制到那里,但是好吧……弊大于利。

Just to show.... 只是为了展示...。

The "build tab" is called "Report Navigator". “构建选项卡”称为“报表浏览器”。 I circled it... 我圈了一下...

在此处输入图片说明

Then you can see the icon to the far right of: 然后,您可以看到最右边的图标: 在此处输入图片说明

Click that button and you will see the text of the build command in its full glory. 单击该按钮,您将看到build命令的全部内容。

Finally, in the option, you can see below that I have the setting defined for a 3rd party library: 最后,在该选项中,您可以在下面看到我为第三方库定义的设置:

在此处输入图片说明

You can even see that I used the "User Header Search Paths" in this case. 您甚至可以看到在这种情况下,我使用了“用户标题搜索路径”。 BTW, I also added the library search path (just above). 顺便说一句,我还添加了库搜索路径(正上方)。

Hope that helps! 希望有帮助!

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

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