adding an external library to a project in XCode 4.3 [duplicate]

∥☆過路亽.° 提交于 2019-12-20 03:41:44

问题


Newbie here, trying to add the CHDataStructures library to a calculator project I'm working on. I did as suggested in the accepted answer at Linking a static library to an iOS project in XCode 4 and have ended up with this:

Unfortunately, I get a 'CHDataStructures.h' file not found error when I try to add the header to classes in my project (Calculator.m, for example).

Any thoughts about how I can get the CHDataStructures library to be, like the Death Star, fully operational?

EDIT

Okay, here's trying both $(SRCROOT) and the absolute path. Any thoughts?


回答1:


By default, Xcode searches for headers recursively in the project's own directory. If you're using a static library, you'll need to use the lib's header files which likely reside somewhere else. There are 2 settings in an Xcode project that allow you specify additional paths to search during compilation:

User Header Search Paths

#import "SomeHeader.h"

Header Search Paths

#import <SomeHeader.h>

Depending on which style you intend to use, pick the appropriate setting, and supply the path to the header files you wish to use:

The paths can be recursive, relative to the project (using $(SRCROOT)/), or absolute. You could also use the derrived data directory if you have Xcode set up correctly.



来源:https://stackoverflow.com/questions/11804149/adding-an-external-library-to-a-project-in-xcode-4-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!