How do I add search paths to gcc

mdh mdh_lists at
Fri Mar 21 11:48:28 PDT 2008

--- Eduardo Cerejo <ejcerejo at> wrote:

> My gcc is only looking in /usr/lib and /usr/include
> for libraries and hearders and I added the paths
> /usr/local/lib/ and /usr/local/include to my .cshrc
> file:
> set path = (/sbin /bin /usr/sbin /usr/bin /usr/games
> /usr/local/sbin /usr/local/bin /usr/local/lib
> /usr/local/include $HOME/bin)

PATH in the environment is where your shell searches
for programs to run from the command line, system(),
etc.  This allows you to type, say, `sh` instead of
having to type out `/bin/sh` or risking having
`/home/somekiddie/sh` run instead when you type it.  

> but I still have to use gcc with -I and -L switch
> for a program to compile or else it will fail.  
> I'm using tcsh.

There are two ways to set up alternate places to find
libraries.  The first is ldconfig, and you can see
ports run this when you install a port containing
shared libraries for example.  The other is to use the
LD_LIBRARY_PATH environment variable to set alternate
paths at run-time.  

The 'ldconfig(1)' man page has more info for you.  

Take care, mdh

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.

More information about the freebsd-questions mailing list