[英]Xcode 4 workspace with two projects can't access each other's files
I have two projects in a workspace. 我在工作区中有两个项目。 Project A needs to access some files in Project B (Kal). 项目A需要访问项目B(Kal)中的某些文件。 When I do an import (in Project A), I start the #import and a popup gives me choices of all the files I have available to me. 当我进行导入时(在项目A中),我启动#import,然后弹出窗口为我提供我可以使用的所有文件的选择。 I choose Kal.h, and immediately get the red flag saying it can't find the file. 我选择Kal.h,并立即得到红色标记,表明它找不到文件。
According to the Apple Docs on Workspaces , XCode should automatically find the file... is this not true? 根据工作区上的Apple Docs ,XCode应该会自动找到该文件...这不是真的吗? Do I still have to set the search paths, etc? 我仍然需要设置搜索路径等吗?
The passage you quote indicates something slightly different than what you want. 您引用的段落表示与您想要的内容略有不同。 In particular, the Workspace has access to both sets of files, but the peer projects do not have access to each other's files. 特别是,工作区可以访问两组文件,但是对等项目则不能访问彼此的文件。
If your Project A needs access to files in Project B, you can set up your workspace that Project A includes a reference to Project B. In this case, Project A will have access to Project B's files, although not vice-versa. 如果您的项目A需要访问项目B中的文件,则可以将工作区设置为项目A包含对项目B的引用。在这种情况下,项目A将可以访问项目B的文件,但反之则不然。 This will work for headers, or for object files. 这将适用于标题或目标文件。
To add one project to another project within a workspace, select the Project A in the workspace, and then choose File > Add Files to Project A...
and select Project B's project file in the standard file window. 要将一个项目添加到工作区中的另一个项目,请在工作区中选择Project A,然后选择File > Add Files to Project A...
然后在标准文件窗口中选择Project B的项目文件。 This will add it to Project A, giving Project A access to the Project B files. 这会将其添加到项目A,使项目A可以访问项目B文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.