Skip to content

Common Environment Variables

鄭余玄 edited this page Jan 20, 2019 · 3 revisions
  • PATH: A list of directories in which to search for executables.
  • LD_LIBRARY_PATH: A list of directories in which to search for ELF libraries at execution-time.

LIBRARY_PATH

Linking using GCC uses these directories when searching for ordinary libraries for the -l option (but directories specified with -L come first).

CPATH, C_INCLUDE_PATH, CPLUS_INCLUDE_PATH

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. This 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.

  • CC: Program for compiling C programs; default cc.
  • CXX: Program for compiling C++ programs; default g++.
  • CPP: Program for running the C preprocessor, with results to standard output; default $(CC) -E.
  • FC: Program for compiling or preprocessing Fortran programs; default f77.
  • CFLAGS: Extra flags to give to the C compiler.
  • CXXFLAGS: Extra flags to give to the C++ compiler.
  • CPPFLAGS: Extra flags to give to the C preprocessor and programs that use it (the C and Fortran compilers).
  • FFLAGS: Extra flags to give to the Fortran compiler.
  • LDFLAGS: Extra flags to give to compilers when they are supposed to invoke the linker, ld, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable instead.

See also: automake, autoconf

Clone this wiki locally