<includes> in upgraded Carbon

Discussion in 'Mac Programming' started by zeppenwolf, Mar 8, 2011.

  1. zeppenwolf macrumors regular

    zeppenwolf

    Joined:
    Nov 17, 2009
    #1
    I have a carbon project with old style includes, like "#include <Sound.h>". I brought the project builder file and source to a X.6 machine, changed the extension, and then did the "Upgrade all targets to native" thing to get rid of the "Jam" business.

    In the project settings, "HEADER_SEARCH_PATHS = Carbon Headers \"Developer/Headers/FlatCarbon\" is listed, that path exists, and it does in fact contain a file called "Sound.h".

    Yet when I compile a source file containing the line, "#include <Sound.h>", it says "no such file or dir".

    In the monster "/Developer/usr/bin/gcc-4.0" command I can see it too: it says '-I"/Developer/Headers/FlatCarbon" ' in there.

    What gives? I could go through all the source adding #ifdefs, since my pch contains Carbon/Carbon.h, (which is all Sound.h does anyway), but I'd prefer not to...

    Thanks.
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Are you sure the Header Search Paths is set for the configuration you're building? e.g. Development/Deployment (or Debug/Release).
     
  3. zeppenwolf thread starter macrumors regular

    zeppenwolf

    Joined:
    Nov 17, 2009
    #3
    Yes, when editing "All Configurations / At This Level", it looks like:


    Header Search Paths | Carbon Headers \"/Developer/Headers/Flat Carbon\"


    and when I click on the value part, it changes to:


    Carbon Headers $(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1)


    In "All configurations / User Defined ", it appears as:


    HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = \"/Developer/Headers/FlatCarbon\"


    and clicking on the value part reveals the variable:


    \"$(SYSTEM_DEVELOPER_DIR)/Headers/FlatCarbon\"
     
  4. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    Weird. I'm not sure. I created a new project, added that path to the header search paths, and #including Sound.h worked fine.

    Possibly there is another setting that is conflicting with it?
     
  5. zeppenwolf thread starter macrumors regular

    zeppenwolf

    Joined:
    Nov 17, 2009
    #5
    OK, this might seem lame, but here it is.

    Where the upgrade process created \"/Developer/Headers/Flat Carbon\" for me, if I just remove the \" pair it works fine.

    Reminds me of college, and struggling with the csh...

    Thanks, kainjow. See you on the next one.
     
  6. Mr. Retrofire macrumors 601

    Mr. Retrofire

    Joined:
    Mar 2, 2010
    Location:
    www.emiliana.cl/en
    #6
    If you use framework-style includes (recommended on Mac OS X), then you must tell the compiler, where he can find the header files and other appropriate files. In the case of Carbon projects, just add

    #include <Carbon/Carbon.h>

    to your prefix file (must be the first line) and add

    /System/Library/Frameworks/Carbon.framework

    to your project. Xcode should find then the other frameworks via

    /System/Library/Frameworks/Carbon.framework/Versions/A/Headers/Carbon.h

    As you see in Carbon.h, the Carbon framework depends on many other frameworks, and Xcode cannot resolve the framework dependencies, if it has no

    /System/Library/Frameworks/Carbon.framework/Versions/A/Headers/

    path. Xcode finds this path automatically via the "Header" alias in

    /System/Library/Frameworks/Carbon.framework/

    This applies to all frameworks within

    /System/Library/Frameworks/

    Btw,
    http://developer.apple.com/library/...l/BPFrameworks/Tasks/IncludingFrameworks.html
     

Share This Page