LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1232|回复: 4

如何更改头文件和库文件的搜索路径?

[复制链接]
发表于 2005-10-10 22:14:38 | 显示全部楼层 |阅读模式
我知道有一个环境变量LD_LIBRARY_PATH是用来更改动态库的路径吧?但是头文件和一些静态的库文件的搜索路径又怎样更改呢?
发表于 2005-10-10 23:15:41 | 显示全部楼层
C_INCLUDE_PATH
回复 支持 反对

使用道具 举报

发表于 2005-10-11 13:29:25 | 显示全部楼层
<>的是默认的" "可以用相对和绝对路径好象
回复 支持 反对

使用道具 举报

发表于 2005-10-11 14:00:35 | 显示全部楼层
Post by nathaniel
我知道有一个环境变量LD_LIBRARY_PATH是用来更改动态库的路径吧?但是头文件和一些静态的库文件的搜索路径又怎样更改呢?

man gcc:


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


  9.        CPATH
  10.        C_INCLUDE_PATH
  11.        CPLUS_INCLUDE_PATH
  12.        OBJC_INCLUDE_PATH
  13.            Each variable's value is a list of directories separated by a spe-
  14.            cial character, much like PATH, in which to look for header files.
  15.            The special character, "PATH_SEPARATOR", is target-dependent and
  16.            determined at GCC build time.  For Microsoft Windows-based targets
  17.            it is a semicolon, and for almost all other targets it is a colon.

  18.            CPATH specifies a list of directories to be searched as if speci-
  19.            fied with -I, but after any paths given with -I options on the com-
  20.            mand line.  This environment variable is used regardless of which
  21.            language is being preprocessed.

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

  26.            In all these variables, an empty element instructs the compiler to
  27.            search its current working directory.  Empty elements can appear at
  28.            the beginning or end of a path.  For instance, if the value of
  29.            CPATH is ":/special/include", that has the same effect as
  30.            -I. -I/special/include.
复制代码
回复 支持 反对

使用道具 举报

发表于 2005-10-11 17:11:25 | 显示全部楼层
如果是gcc,编译得时候用-I可以指定头文件,
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表