Adding source files to XCode

Discussion in 'Mac Programming' started by jsnuff1, Apr 7, 2009.

  1. macrumors 6502

    Joined:
    Oct 4, 2003
    Location:
    NY
    #1
    I am using an open source project that will be part of my application that I need to add to xcode and have it compile.

    I take the src folder and add it to XCode and there are two options..

    Recursively create groups for any added folders
    This creates a yellow folder in XCode and attempts to compile, but XCode cannot find any of the header file paths...

    the includes in the source files look like this,

    #include <checker/impl/utils/Logging.h> and i get the error no such file or directory


    The other option adds the source as a blue folder, but does not compile the code, simply just copies the source folder to the target.

    So whats the proper way of adding this, and keeping all the folder directories intact and having XCode know where everything is?
     
  2. macrumors regular

    Joined:
    Mar 5, 2006
    #2
    When adding folders of source code files, you want to recursively create groups. As you noticed, creating folder references is for folders you want copied to the application bundle, such as folders of data, graphics, and audio files.

    What you need to do is add a search path for your header files. In Xcode 3, choose Project > Edit Project Settings to modify your project's build settings. In the Search Paths collection are settings to add search paths for header files, libraries, and frameworks.
     
  3. thread starter macrumors 6502

    Joined:
    Oct 4, 2003
    Location:
    NY
    #3
    well I found the problem

    changing

    #include <checker/impl/utils/Logging.h>

    to simply

    #include "Logging.h"

    fixes the problem when I added the search path...unfortunately there are hundreds of header/source files that I would have to change..so how can I make it work with the first format?
     
  4. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    Reread szymczyk's second paragraph.
     
  5. thread starter macrumors 6502

    Joined:
    Oct 4, 2003
    Location:
    NY
    #5
    I have already added the proper search paths. The problem is all the source files have their dependancies in the format of my first example on my post above. This causes XCode to not be able to locate them. Rewriting that #include line with simply just the name in quotations (without any path information) makes XCode understand where it is.

    Problem is there are hundreds of these lines I have to change, and Id rather not do all that work if there is a way to make it work with the first format.
     
  6. macrumors member

    Joined:
    Aug 26, 2008
    #6
    When you added your search path for your header files, what path did you use? Was it something like '/base/directory/checker/impl/utils'? If so, I wonder if it would work if you just used '/base/directory'. I'm not very familiar with XCode, but it seems as though the compiler is looking too far into the path (it finds Logging.h so it's looking at the checker/impl/utils directory).
     
  7. thread starter macrumors 6502

    Joined:
    Oct 4, 2003
    Location:
    NY
    #7
    no, I just point it at the base source folder.

    I guess it just comes down to understanding what <> vs "" means for #include's

    Can anyone explain the difference?
     

Share This Page