Tech Support > Operating Systems > Linux / Variants > Changing INCLUDE directories
Changing INCLUDE directories
Posted by Manu J on December 1st, 2003


Hi,
If i wanted to change the directories which are serached for header files
(/usr/include etc) what should i do.
The change need to be system wide.

Thanks in advance
Manu

Posted by Alan Connor on December 1st, 2003


On 30 Nov 2003 23:44:19 -0800, Manu J <boundlessdreamz@yahoo.co.in> wrote:
Make the new paths symlinks to /usr/include/*. Or edit the makefiles
for every application, etc., you want to build from source.

Why would you want to do this?

AC


Posted by Alan Connor on December 1st, 2003


On 30 Nov 2003 23:44:19 -0800, Manu J <boundlessdreamz@yahoo.co.in> wrote:
Make the new paths symlinks to /usr/include/*. Or edit the makefiles
for every application, etc., you want to build from source.

Why would you want to do this?

AC


Posted by Floyd Davidson on December 1st, 2003


boundlessdreamz@yahoo.co.in (Manu J) wrote:
Maybe you should explain what you want to accomplish, because
that doesn't sound like a particularly good idea.

--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@barrow.com

Posted by osmoma on December 1st, 2003


Manu J wrote:
Alternatives:

1) Copy your includes into /usr/include/<directory>


2) Use -I compiler option
-I /usr/xxx/:/usr/yyyy/

$ gcc -I/xxx/ foo.c


3) There are also:
CPATH
C_INCLUDE_PATH
CPLUS_INCLUDE_PATH

$ export C_INCLUDE_PATH=/usr/zzzz:$C_INCLUDE_PATH
$ export CPLUS_INCLUDE_PATH=/usr/zzzz:$CPLUS_INCLUDE_PATH

LD_LIBRARY_PATH (for libraries of course)


Read more in:
http://gcc.gnu.org/onlinedocs/gcc-3....nt%20Variables

http://home.online.no/~osmoma/#programming


// os moma
http://www.futuredesktop.org

Posted by Manu J on December 2nd, 2003


Floyd Davidson <floyd@barrow.com> wrote in message news:<8765h0dia1.fld@barrow.com>...
Hi,
It's because when i compile from source many of the include
directories are created in /usr/local/include or some other directory
or
if i compile with
../configure --prefix=/home/manu/lame
then that direcory will contain the include files and when i compile
another
application which need those files i need to manually edit the
makefiles which is a pain.
:-)

--Manu

Posted by Floyd Davidson on December 3rd, 2003



[Top Posting Corrected]

boundlessdreamz@yahoo.co.in (Manu J) wrote:
Well, the solution seems obvious to me... don't use
"--prefix=/home/manu/lame" if you want the libraries and header
files installed in places where you can access them. The
INSTALL file with lame, for example, says

--prefix = PATH default is /usr/local
(LAME currently installs:
/usr/local/bin/lame
/usr/local/lib/libmp3lame.a
/usr/local/lib/libmp3lame.so
/usr/local/include/lame.h

I suspect you might (and I could be _way_ off base with this) be
thinking of doing things the way DOS does, where you have a
separate directory for each of your apps??? Don't do it! The
above set of defaults is just fine, and should be used unless
you have some particular reason not to, and in that case you
suffer the consequences.

Of course, if that is not what you're thinking of, then you have
other configuration problems. If the include files are in
/usr/local/include, then gcc should be able to find them. You
can verify that easily enough.

floyd ~/ >cpp -v /dev/null
Reading specs from /usr/lib/gcc-lib/i386-slackware-linux/3.0/specs
Configured with: ../gcc-3.0/configure --prefix=/usr --enable-shared --with-gnu-ld --enable-threads --verbose --target=i386-slackware-linux --host=i386-slackware-linux
Thread model: posix
gcc version 3.0
/usr/lib/gcc-lib/i386-slackware-linux/3.0/cpp0 -lang-c -v -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ /dev/null
GNU CPP version 3.0 (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/i386-slackware-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc-lib/i386-slackware-linux/3.0/include
/usr/include
End of search list.

Clearly one can configure gcc to look, by default, just about
anywhere. Just as clearly you don't want to abuse that idea,
but you do want to be sure that the standard places are
configured. If your gcc isn't looking in /usr/local/include,
fix it. If it is, *don't* add something odd...

--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@barrow.com


Similar Posts