Reputation: 1474
I am trying to use OpenBabel and am experiencing great difficulty with setting 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?
Upvotes: 7
Views: 11557
Reputation: 86
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:
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.
Upvotes: 5
Reputation: 26060
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
Upvotes: 5