Thread: How do I add include paths in GCC?

  1. #1
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218

    How do I add include paths in GCC?

    My GTK headers are in [include]/gtk-2.0/,
    but the headers refer to themselfes as being in [include]. Can I change this, without moving the files, such as editing some path file?

  2. #2
    Registered User
    Join Date
    Jul 2002
    Posts
    913
    Salmon posted this for me awhile ago, sounds like this is what you need.
    gcc test.c -I/path/to/myinclude -L/path/to/mylib -lfoo

    where
    -I adds a directory to the list of dirs where #include <> files are found
    -L adds a directory to the list of dirs where .a files are found
    -l specifies the name of a library to search ("lib" and ".a" are assumed

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    YOu can also use LD_LIBRARY_PATH environment variable, but in some situations it is considered bad.

    You can edit ld.so.conf to change default paths. But be careful with this and make sure you know what you're doing.
    Last edited by rotis23; 08-01-2003 at 06:20 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. file i/o dilemma
    By adramalech in forum C Programming
    Replies: 27
    Last Post: 11-11-2008, 12:30 AM
  2. VC++ release exe exits immediately after execution
    By nocturna_gr in forum Windows Programming
    Replies: 6
    Last Post: 02-09-2008, 05:26 AM
  3. Multiple include problem
    By VirtualAce in forum Game Programming
    Replies: 13
    Last Post: 02-04-2006, 06:09 PM
  4. to #include or not to #include
    By krygen in forum C++ Programming
    Replies: 9
    Last Post: 12-25-2004, 12:06 AM
  5. Where can i add a header file other than include directory
    By asdfasdfasdf in forum C++ Programming
    Replies: 4
    Last Post: 09-26-2002, 07:23 AM