开发者

Linux Global Includes Path

开发者 https://www.devze.com 2023-01-24 02:21 出处:网络
I am trying to use OpenBabel and am experiencing great difficulty with set开发者_如何学Goting up a global search path for include files. I have successfully linked to the libraries with $LD_LIBRARY_PA

I am trying to use OpenBabel and am experiencing great difficulty with set开发者_如何学Goting up a global search path for include files. I have successfully linked to the libraries with $LD_LIBRARY_PATH, but when compiling with the GNU C++ compiler, it cannot find the include files. Is there a global include environment variable on Linux, and if so, what is it?


You could give the include path to GCC using the option -I:

g++ -I/path/to/the/include/dir blabla

Please note that also the library dir may be bassed via -L option -L/path/to/lib/dir. LD_LIBRARY_PATH is usually considered a dirty hack.

You can have multiple -I (and -L) options:

g++ -I/dir/include1 -I/dir/include2


If you check the manpage for cpp (the C Preprocessor), it state that it will treat the following environment variables like the -I option mentioned above:

  • CPATH
  • C_INCLUDE_PATH
  • CPLUS_INCLUDE_PATH

Now, I believe that current g++ and gcc use an inbuilt cpp, but I would expect that it would function like the stand alone cpp, and respect these environment variables.

0

精彩评论

暂无评论...
验证码 换一张
取 消