Thread: Library Path

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    1

    Library Path

    Hi,

    I'm trying to compile a C project with GCC. Meanwhile I want to use other "include" files rather than the system ones. I've tryed to use the -I switch, but it didn't work. Isn't there a environment variable that can be set to the libraries path I want? And if it exists, how do I change it - in a Linux environment?

    Best regards,

    Rigel_kent

  2. #2
    .
    Join Date
    Nov 2003
    Posts
    307
    From the man page for cpp (the gcc preprocessor)
    -I dir
    Add the directory dir to the list of directories to be searched for
    header files.

    Directories named by -I are searched before the standard system
    include directories.

    It is dangerous to specify a standard system include directory in
    an -I option. This defeats the special treatment of system headers
    . It can also defeat the repairs to buggy system headers which GCC
    makes when it is installed.
    Plus:
    Code:
    #include "somefile.h"
    quoted files names forces cpp to look for somefile.h using the "-I directory" specification first. Filenames in trackets "<>" are assumed to be in the standard include directory.

    Code:
    gcc -I. -Wall myfile.c -o myfile
    will find somefile.h in your current working directory before it looks anywhere else.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Property Set Library (PSL) - Announcement
    By vultur_gryphus in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 05-29-2008, 06:04 AM
  2. Adding a directory to a dynamic library path
    By vivharv in forum Windows Programming
    Replies: 3
    Last Post: 09-20-2007, 07:09 AM
  3. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 07:55 AM
  4. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM
  5. Library build path
    By aker_y3k in forum C++ Programming
    Replies: 7
    Last Post: 10-05-2002, 12:46 AM