2

I separated my header files in folders like:

libraryA
  |-libA1.h
  |-libA2.h

libraryB
  |-libB1.h
  |-libB2.h

Xcode however removes the path by default, so

#include "libraryA/libA1.h"
#include "libraryB/libB1.h"

doesn't work, only:

#include "libA1.h"
#include "libB1.h"

How can I make xcode preserve the path names for includes?

lajos
  • 25,525
  • 19
  • 65
  • 75

2 Answers2

4

In the build pane for the target, set Header Search Paths to $(SRCROOT) (assuming these are at the top level), or $(SRCROOT)/include, or whatever matches. I only suggest using the build pane here for simplicity sake. I actually recommend that people abandon the build pane and use xcconfig files, in which case, the setting is HEADER_SEARCH_PATHS.

Rob Napier
  • 286,113
  • 34
  • 456
  • 610
  • @Rob: so basically, if HEADER_SEARCH_PATHS is not set, all the paths are removed, but if it has any value, then the paths are preserve d? – lajos May 27 '09 at 03:41
  • No. The default is to look for files directly added to your project. Then it looks in HEADER_SEARCH_PATHS. If HEADER_SEARCH_PATHS is $(SRCROOT), which might expand to /Users/rob/MyCoolProject, then it will look for libraryA/libA1.h in /Users/rob/MyCoolProject/libraryA/libA1.h after looking directly in added files to the project. (But no file in the project will have the name "libraryA/libA1.h". The name of the file is "libA1.h".) – Rob Napier May 27 '09 at 03:45
0

The groups in Xcode's file list don't necessarily correspond to folders on disk. If you really want them to work that way, you need to create folders in your source tree, move your headers there, then get info on your file groups in Xcode and point them at the new folders.

Lily Ballard
  • 182,031
  • 33
  • 381
  • 347