how to import/include header file in Xcode 4.2.1 ?

Discussion in 'Mac Programming' started by hieuhoang, Feb 18, 2012.

  1. macrumors newbie

    Joined:
    Feb 18, 2012
    #1
    Hi ,

    I am new to Xcode and I am struggling with this : I have some .h files and have tried to put them to /usr/include or /usr/local/include or one directory but when importing or including in xcode I met this : lexical or preprocessor issue 'string' file not found .

    anyone know how to fix this ? thanks in advance
     
  2. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #2
    Slow down, cowboy.

    Putting header files into /usr/include or similar is a VERY BAD IDEA unless you know exactly what you are doing - which you don't. You are in danger of SERIOUSLY MESSING UP YOUR MACINTOSH.

    Why don't you start from the beginning and tell us what you are actually trying to do?
     
  3. macrumors member

    Joined:
    Jan 16, 2011
    #3
    There are two things to check:

    1. Check your system path to see if /usr/include or /usr/local/include are on your path. Do this by going to the terminal and entering "echo $path".

    2. As a backup, you can set this is your project settings. In the file listing on the left side, click on the project. Go to the build settings tab and check the paths that are set there. You can specify specific paths to check for headers.
     
  4. thread starter macrumors newbie

    Joined:
    Feb 18, 2012
    #4
    thank you, but what is the good idea ? I have no ideas to start (from the beginning ) . Any advices ?
     
  5. thread starter macrumors newbie

    Joined:
    Feb 18, 2012
    #5
    Hi, I did as yours but . "echo $path" responsed nothing !
     
  6. thread starter macrumors newbie

    Joined:
    Feb 18, 2012
    #6
    hi, my problem was solved !
     
  7. macrumors Pentium

    KnightWRX

    Joined:
    Jan 28, 2009
    Location:
    Quebec, Canada
    #7
    What do you think adding /usr/include and /usr/local/include to the lower case path variable would accomplish exactly ?
     
  8. macrumors member

    Joined:
    Jan 16, 2011
    #8
    Oh, hmmm. I should watch my capitalization.
     
  9. macrumors Pentium

    KnightWRX

    Joined:
    Jan 28, 2009
    Location:
    Quebec, Canada
    #9
    Capitalization aside, what do you think adding /usr/include and /usr/local/include to a properly capitalized PATH variable does ?
     
  10. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #10
    Of course. Read my previous post, then spot this line:

    "Why don't you start from the beginning and tell us what you are actually trying to do?"
     

Share This Page