using includes with include path

Discussion in 'Mac Programming' started by eddyq, Aug 10, 2009.

  1. eddyq macrumors member

    Joined:
    Jun 10, 2009
    #1
    The compiler does not find config/config.h

    I have an include like this:
    #include <config/config.h>
    My project is at the same level as the "config" folder.
    In Project->Edit Active Target "xxx" I entered the search paths under Search Paths->Header Search Paths as ".". I also tried "./" and I also tried just eliminting the path.
    I have verified that config/config.h is available.
    It does not find config.h.
    I then copied config.h into the level above (same level as the project) and the compiler finds it for all cases of ".", "./" and nothing.

    So my question is ... with an include as above, what is the correct procedure to get the compiler to find the given .h file? (note that on other systems such as NetBSD and Linux the include directive is the correct format).
     
  2. eddyq thread starter macrumors member

    Joined:
    Jun 10, 2009
    #2
    Never mind ... I didn't realize that when I made the project it made a new folder for the xcodeproj file. So instead of "." I have to use "..".
     
  3. eddyq thread starter macrumors member

    Joined:
    Jun 10, 2009
    #3
    Well I spoke too soon. Using .. does not work. Does anyone know how to specify the above mentioned include path?
     
  4. SRossi macrumors regular

    Joined:
    May 27, 2009
    Location:
    Glasgow, Scotland
    #4
    Is it a framework or is it just a normal header file.

    If it is just a header file have u self created it or is it a system created header?

    Stephen
     
  5. eddyq thread starter macrumors member

    Joined:
    Jun 10, 2009
    #5
    The headers are my own headers.

    Desktop
    -top_level_folder
    --foo
    ---foo.h
    ---bar.h
    ---foo.c
    --baz
    ---baz.h
    --project_folder
    ---name.xcodeproj


    Throughout the source, header files are included like "#include <foo/foo.h>", "#include <baz/baz.h>"

    I have added ".." to the Project->Edit Active Target "name"->Search Paths->Header Search Paths. I also tried using /Users/eddyq/Desktop/top_level. I also tried ".".

    I just can't get the compiler to find the the .h files.
     
  6. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #6
    When you enclose the header name in < >, it means a system include. For user includes, i.e. ones you provide, you should be using "foo/foo.h", and you should specify a user-include path that contains the "foo" folder where "foo.h" can be found.
     

Share This Page