My desired setup is a main pro开发者_如何学运维ject, which depends on a subproject (which generates a static library). Adding the subproject to Xcode works fine, but as you'd expect you have to set the User Header Search path to include the subproject's folder, unless you want to add the subproject's files to the main project explicitly, which sort of defeats the purpose of the subproject.
From what I can tell, setting the User Header Search path will break code sense and "jump to definition" navigation in the main project, next time your open the project.
Here's a sample, super simple, stock project that illustrates the problem:
http://dl.dropbox.com/u/579169/MainProject.zip
If you go to the Application Delegate and try to jump to definition on a property reference, say self.window, Xcode simply gives you a list of all the "window" properties it knows about. Likewise, autocomplete fails to work.
If you delete the user header search path, close the project and reopen it, code sense works as expected.
I've filed a bug with Apple, but was wondering if anyone has run into this specific problem, or has a reasonable workaround. Deleting the project "derived" build folder to trigger a reindex doesn't work reliably.
A work around is to make the headers public in the static library. Then add the following to user header search paths
"${BUILT_PRODUCTS_DIR}/usr/local/include/"
I reported this to Apple, and they report that it was fixed 6/6/2011 in XCode 4.1 (which is Lion only). I have not confirmed the fix as I have not upgraded my development machine to Lion beta.
精彩评论