Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

xcode

ios

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.

like image 457
Duane Fields Avatar asked May 31 '11 16:05

Duane Fields


1 Answers

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/"
like image 73
Ian1971 Avatar answered Nov 15 '22 08:11

Ian1971