Xcode4工作区共享项目
我正在尝试使用新的 Xcode4 工作区功能来迁移一些之间具有依赖关系的 Xcode3 项目。我有一个创建静态库的项目,然后是一个依赖于静态库的应用程序项目。因此,正如指南中提到的,我创建了一个新的工作区并将这两个项目拖到工作区中。但是,当我构建应用程序时,它无法从静态库中找到头文件。我收到“没有这样的文件或目录”错误。我的目的是让 Xcode 自动检测依赖项。但是,不确定我做错了什么,我无法让它工作。 非常感谢任何帮助。那里也没有太多文档。
I am trying to use the new Xcode4 workspace feature to migrate some Xcode3 projects that has dependencies between them. I have a project which creates a static library and then an application project which depends on the static library. So, as the guide mentioned, I created a new workspace and dragged both the projects into the workspace. However, when I build my application, it's unable to find the header files from my static library. I get "No such file or directory" error. My intention is to let Xcode auto detect the dependencies. But, not sure what I am doing wrong, I couldn't get it to work.
Any help is greatly appreciated. There isn't much documentation out there either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
经过几个令人沮丧的小时后,我可能找到了解决方案(仍然不确定这是否是正确的方法)。
进行了清理和构建,一切都已成功构建。
然而,我仍然不相信这是正确的方法,因为根据 Xcode4 指南,不需要更改设置,只需将项目添加到工作区即可解决所有问题。有一天,我希望找到正确的解决方案并使用它。
谢谢
贾维德
After few frustrating hours, I may have found a solution (still not sure if it's the right way).
Did a clean and build and everything was built successfully.
However, I am still not convinced this is the right way, as according to Xcode4 guide, no changes to settings is necessary, just adding projects to workspace will take care of everything. Someday, I hope to find the correct solution and use it.
Thanks
Javid
至少有几种方法可以解决这个问题。
我所做的是为主目标的用户标头搜索路径构建设置设置一个值,指向库路径。只需在构建设置编辑器搜索框中输入“用户标题”即可找到它。
如果您正在使用打算经常使用的库,最好为其设置源代码树设置。这是在 XCode Prefs -> 中源树。添加一个条目,放入库源的路径,并为其指定一个合理的设置名称,例如。 XXLIBRARY_SOURCE。然后在用户标头搜索路径(或需要库路径的任何其他构建设置)中,可以使用 $(XXLIBRARY_SOURCE) 作为路径。
一个更简单但不太灵活的替代方案是将库的标头拖到您的主项目中。
There are at least a couple of ways to go about this.
What I do is set a value for the User Header Search Path build setting for the main target, pointed to the library path. Just type 'user header' in the build settings editor search box and you'll find it.
If you're consuming a library that you intend to use often, it's best to set up a source tree setting for it. This is in XCode Prefs -> Source Trees. Add an entry, put in the path to the library source, and give it a sensible Setting Name, eg. XXLIBRARY_SOURCE. Then in the user header search path (or any other build setting where you need the library path), you can use $(XXLIBRARY_SOURCE) as the path.
A simpler but less flexible alternative is just to drag the library's headers into your main project.
问题似乎在于 Xcode 环境变量报告了错误的位置。例如 $(TARGET_BUILD_DIR) 转换为:
/build/Debug/
..但是使用工作区时,会在该路径中插入额外的文件夹:
/build/products/Debug
。 .Xcode 似乎忽略或无法处理。
The issue seems to lie with the Xcode environment variables reporting the wrong location. For instance $(TARGET_BUILD_DIR) translates to:
/build/Debug/
..but when using workspaces an extra folder is inserted into that path:
/build/products/Debug
..which Xcode seems to ignore or can't handle.