This is the mail archive of the
mailing list for the GCC project.
paths for headers and libraries
- From: David Byron <dbyron at coactive dot com>
- To: "'gcc at gnu dot org'" <gcc at gnu dot org>
- Date: Fri, 15 Feb 2002 14:22:39 -0800
- Subject: paths for headers and libraries
I'm confused about where gcc looks for header files and libraries regarding /usr/local. I've got one version of a library and header file installed in /usr/include and /usr/lib, and a different version installed in /usr/local/include and /usr/local/lib.
When compiling with no switches for modifying the include search path, I see from gcc -v that it's looking in /usr/local/include first. This is fine, except that when linking with -l, and no switches for modifying the library search path, the library gets picked up from /usr/lib.
Is this the default behavior of gcc, or some artifact of configure switches or something else? Is there some way to set things up so I don't have to explicitly specify -L/usr/local/lib for every executable I build that uses this dually-installed library?
Sorry if this is a FAQ.
GNU CPP version 2.95.2 20000220 (Debian GNU/Linux) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
End of search list.
$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs
gcc version 2.95.2 20000220 (Debian GNU/Linux)
$ gcc -print-search-dirs
$ uname -a
Linux porto 2.2.18pre21 #4 SMP Mon Apr 23 18:58:11 PDT 2001 i686 unknown
David Byron email@example.com
Coactive Networks, Inc. http://www.coactive.com
28 Liberty Ship Way voice:(415)289-7800
Sausalito, CA 94965 fax:(415)289-1320