• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Extreme Search Path Problems!!!!!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Extreme Search Path Problems!!!!!


  • Subject: Re: Extreme Search Path Problems!!!!!
  • From: Andreas Grosam <email@hidden>
  • Date: Thu, 4 Aug 2005 12:53:58 +0200


On 04.08.2005, at 02:03, Ando Sonenblick wrote:

Gang,

I'm have a seriously bad day here trying to import a CW project into Xcode and get it to compile.

The problem is that Xcode cannot find the include files. The apparent reason is that the code has "pathed" includes. That is, instead of a typical #include "foo.h" it uses #include "project/code/headers/foo.h"

This seems to confuse Xcode and prevents it from finding the header foo.h

I had added the root folder to the Header Search Paths (dragging it in to the Search Paths UI to ensure the path is accurate relative to the project) and made it recursive... no luck.

I've even added every single folder along the path and made them recursive... still no luck. I even tried making them non recursive... no luck.

If I simply change the include to be #include "foo.h" then Xcode is happy. However, this approach is extremely tedious because the code also compiles on windows and so I have to change every instance of inclusion but only if using Xcode as we need to maintain the windows build. So each:

#include "myproject/code/headers/foo.h"

has to become:

#ifdef XCODE
    #include "foo.h"
#else
   #include "project/code/headers/foo.h"
#endif

And we've got hundreds of files with hundreds of includes and so on... an extreme amount of extremely tedious work...

So, is there something I'm missing with Xcode? Can it handle "pathed" includes? What do I need to do to get it to find our header files?

Thanks a vast, huge, ginormous amount ahead of time... if you can help, you'll surely be preventing a massive and murderous going postal rampage on my part...

Note, that there is a known problem in XCode when you specify paths which include "/../" (go back one level).
Try to use absolut serarch paths.


Suppose you specified these header search paths:
/A/B/C
/A/B/D

when you try to include a header like
#include "a/b/c/foo.h"

the compiler searches for the header "foo.h" in
<current>/a/b/c/
/A/B/C/a/b/c/
/A/B/D/a/b/c/

If the header foo.h is in your project, XCode emits search paths so that foo.h will be always found by the compiler when you include it with
#include "foo.h"
no matter where it is actually located, and which search paths are specified.



Beside this, in your include directive you shouldn't specify a hard coded path pointing to some specific location. The include directives should always be relative to the root of your project.
That means,
#include "a/b/c/foo.h"
the folder "a" shall be located *within* your path to the project, e.g.:
${HOME}/Develop/Projects/xyzProject-1.2/a/b/c/


Never let "a" be the root of your project.

Andreas

Ando
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Extreme Search Path Problems!!!!! (From: Ando Sonenblick <email@hidden>)

  • Prev by Date: Re: Xcode debugging UI question
  • Next by Date: 10.4 SDK does not support ZeroLink, disabling it.
  • Previous by thread: Re: Extreme Search Path Problems!!!!!
  • Next by thread: Re: Extreme Search Path Problems!!!!!
  • Index(es):
    • Date
    • Thread