tags:

views:

85

answers:

1
+1  Q: 

Linking in Xcode

How do I make Xcode link object files properly?

The file containing "main" and all the dependencies compile properly (and I can easily link them in the command line to generate the executable). However, Xcode seems to refuse to do it, resulting in ld errors of "symbol not found".

This is what my current setup looks like. All the dependencies (Calculator, input, etc) are detected and compile properly. The cpp file contains main but fails to be linked to the .o file (generated by the dependencies), resulting in several ld "symbol not found" errors.

alt text

Any ideas?

+1  A: 

.o's generated by dependencies do not get linked into the including target. In the example above, "Calculator" needs to generate something, generally a static library (.a), that you would then add to the list of libraries to be linked into the project.

Rob Napier
What Rob and Ben are getting at is that dependencies and linking are separate functions. You're just making sure that Calculator is getting built, but not necessarily linking Untitled against Calculator's built binary. Drag the Calculator build product into the Link Binary with Libraries build phase.
cdespinosa