Library Path

This is a discussion on Library Path within the Linux Programming forums, part of the Platform Specific Boards category; Hi, I'm trying to compile a C project with GCC. Meanwhile I want to use other "include" files rather than ...

  1. #1
    Registered User
    Join Date
    Nov 2004

    Library Path


    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,


  2. #2
    Join Date
    Nov 2003
    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.
    #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.

    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, 07:04 AM
  2. Adding a directory to a dynamic library path
    By vivharv in forum Windows Programming
    Replies: 3
    Last Post: 09-20-2007, 08:09 AM
  3. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 08:55 AM
  4. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 03:53 PM
  5. Library build path
    By aker_y3k in forum C++ Programming
    Replies: 7
    Last Post: 10-05-2002, 01:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21