Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » gcc: INCLUDE_PATH and LIBRARY_PATH

This thread is locked; no one can reply to it. rss feed Print
gcc: INCLUDE_PATH and LIBRARY_PATH
Marco Radaelli
Member #3,028
December 2002
avatar

I set them properly, but it seems that gcc isn't using them. Is there a switch I should use?

I'm saying this because I compiled a gtk example (on Windows) and if I set the list of directories in the two environment variables, gcc complains about missing header files, but if I pass the directories with, respectively, -I and -L everything works perfectly

BAF
Member #2,981
December 2002
avatar

-I\blah\ for include and -Lblah for library path.

[edit] Didnt read your part where you said -I and -L you used.

Marco Radaelli
Member #3,028
December 2002
avatar

I said:

but if I pass the directories with, respectively, -I and -L everything works perfectly

;)

BAF
Member #2,981
December 2002
avatar

See my edit :P

Kitty Cat
Member #2,815
October 2002
avatar

Isn't the library env var LD_SEARCH_PATH? I don't recall exactly what it its, but I remember the LD_ and I don't think LIBRARY was a part of it.

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Arthur Kalliokoski
Second in Command
February 2005
avatar

There's also some config file (ascii) somewhere that tells gcc where the default stuff is, I remember fiddling with it so I could have my own libraries & headers separate from the default locations. IIRC, putting the -v switch in while compiling something will show this process and which file tells it to look where for include & lib.

They all watch too much MSNBC... they get ideas.

Marco Radaelli
Member #3,028
December 2002
avatar

I finally found it in the docs :)

gcc manual said:

LIBRARY_PATH
The value of LIBRARY_PATH is a colon-separated list of directories, much like PATH. When configured as a native compiler, GCC tries the directories thus specified when searching for special linker files, if it can't find them using GCC_EXEC_PREFIX. Linking using GCC also uses these directories when searching for ordinary libraries for the -l option (but directories specified with -L come first).

And I remember this one...

gcc manual said:

CPATH
C_INCLUDE_PATH
CPLUS_INCLUDE_PATH
OBJC_INCLUDE_PATH
Each variable's value is a list of directories separated by a special character, much like PATH, in which to look for header files. The special character, PATH_SEPARATOR, is target-dependent and determined at GCC build time. For Windows-based targets it is a semicolon, and for almost all other targets it is a colon.

CPATH specifies a list of directories to be searched as if specified with -I, but after any paths given with -I options on the command line. The environment variable is used regardless of which language is being preprocessed.

The remaining environment variables apply only when preprocessing the particular language indicated. Each specifies a list of directories to be searched as if specified with -isystem, but after any paths given with -isystem options on the command line.

I didn't recall these, maybe they're new?
However, after setting CPATH and LIBRARY_PATH I got everything working again. Woo :)

Evert
Member #794
November 2000
avatar

There's LD_LIBRARY_PATH and several other LD_ environment variables (LD_SEARCH_PATH may be there as well, don't know). These are for the loader (linker for Windows people) and specify directories where shared objects are looked for.

Marco Radaelli
Member #3,028
December 2002
avatar

Quote:

There's LD_LIBRARY_PATH and several other LD_ environment variables (LD_SEARCH_PATH may be there as well, don't know). These are for the loader (linker for Windows people) and specify directories where shared objects are looked for.

To which version are you referring to? I can't find them in the docs I have (could be... the ones I have are for gcc 3.2.3 ;D, going to update them)

[edit]

Just updated to the docs for gcc 3.4.4, but I can't find any page on LD_* environment variables

Evert
Member #794
November 2000
avatar

LD_LIBRARY_PATH is documented in the documentation for ld, not gcc. Not too well documented though; I'm sure there must be a better place where it's documented, but I'm not sure where.

marcin
Member #5,814
May 2005

Go to: