In Xcode 4, setting User Header Search path breaks code sense

My desired setup is a main project, 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.

链接地址: http://www.djcxy.com/p/7376.html

上一篇: 个人热点蓝条问题

下一篇: 在Xcode 4中,设置用户标题搜索路径会破坏代码意义