0

I have a static library project that I inherited from another developer. I added a class to the project and built it. When I include the static lib in another project, the build fails with a symbol not found error for the class that I added.

I looked at the build logs for the static lib project and I noticed that the .m file isn't compiled. The file is clearly visible in Xcode, right next to all of the other class files. Can anyone think of a reason that the file wouldn't be built? How does Xcode discover the files that it builds?

1 Answer 1

2

Make sure the new file is included in the target you're trying to build.

Click on the filename in the left pane of XCode and open the inspector (command-I), then look at the "targets" tab to verify that the target you're building is checked.

If necessary, you can also expand the target (in the left pane) to see the build steps, and drag the file directly into the build step (for example "Compile Sources") where it needs to be.

Sign up to request clarification or add additional context in comments.

2 Comments

That was it. I wonder why it wouldn't be included in the target by default? Thanks!
Whether you create files or add them in to the project from outside, there is an option on the dialog box to choose which target to add it to. Mostly this is set to the main target by default, just be aware that if you have multiple targets in your app, that you double-check that it is set to the right one.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.