user1161310
user1161310

Reputation: 3139

How to use headers from subproject in workspace? [PICTURE]

I have an a project called azadi and i want to use the header files from another xcode project. I figured the best way to make it easy to do so was to create a workspace and add both projects to it.

I've dragged both projects into one workspace, but i can't reference any files from S3.xcodeproj in Azadi.xcodeproj.

What am i missing?

My workspace

Upvotes: 1

Views: 190

Answers (1)

EsbenB
EsbenB

Reputation: 3406

It's not completely clear what kind of project you have added, but let's assume project2 is a static library.

In the description of the steps below I assume project1 is your primary project, and project2 is the one containing functionality needed by project1

First of all, don't drop project2 in the workspace. Drop it inside project1

Then follow those steps:

1) Select the project2 project and select "Build phases" in the top.

2) Expand "Copy Headers"

3) Select all files except the "*.pch" file.

4) Create a folder in project1 called "Indexed Headers" and drag the selected files to this folder. Make sure that "Copy items into destination group's folder (if needed)" and "Add to targets" are both unchecked. Click "Finish." (Note:this step is needed to get autocompletion working properly)

5) Now select your Xcode project in the top of the project navigator.

6) Select "Build phases" Expand "Target dependencies" and click the "+"

8) Select "project2" and click "Add" Expand "Link Binary With Libraries" and click the "+"

9) Select "project2" and click "Add"

You're done! Your project should now build when you hit Cmd+B

Upvotes: 1

Related Questions