Edit Header Search Path of gcc in terminal

Discussion in 'Mac Programming' started by ScKaSx, Dec 10, 2007.

  1. ScKaSx macrumors regular

    Joined:
    Feb 27, 2006
    #1
    Hi All,

    I use gcc in terminal to compile my c/c++ code and I was wondering how to edit where it looks for include files? Naturally, I have afew header files that aren't standard and I want to add a path to the gcc compiler for include files I create and/or use from other sources. Thanks and any suggests will be useful.

    Cheers,
    ScKaSx
    MacBook 10.4.9 Intel
     
  2. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #2
    The -I option is your friend, if you need to specify a non-standard include directory for compiling purposes. It's used like this:
    Code:
    gcc -I/path/to/include/directory file.ext
     
  3. ScKaSx thread starter macrumors regular

    Joined:
    Feb 27, 2006
    #3
    Thanks for the quick reply.

    It's working!
    Cheers,
    ScKaSx
     
  4. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #4
    I'm not sure, but I think you need quotes. Yes, that second command is valid - Mac OS X understands ~ to be the path to your home foler.
     

Share This Page