newbie looking to add include files
Rupert Wood
me@rupey.net
Tue Feb 4 18:21:00 GMT 2003
Mark Petryk wrote:
> I would like to add some files to the list of standard include (*.h)
> files, kind of like a library, to the standard search path of include
> files. I see that there are many include files in /usr/include with
> many sub directories. Copying my files into yet another sub directory
> under /usr/include did not see to make those files available to the
> compiler using:
Agree with Eljay, but as an aside: you don't want to do that. Usually:
* /usr/include (and /usr/lib) belong to the operating system. They
should come only from the original OS install. You do not mess
with these files.
(In particular, some of them may be overridden by GCC's
"fixincluded" versions and your changes will never be used.)
* /usr/local/include and /usr/local/lib are for system-wide
header and library installation. They should be picked up
automatically (especially on linux distribution installs) but
you may need to verify that /usr/local/lib is in the
LD_LIBRARY_PATH environment and that you pass -I and -L
if necessary.
* ~/include and ~/lib (i.e. in your home directory) - or
sometimes ~/local/include and ~/local/lib - are for headers
and libraries you want to install in your own build
environment. You will have to add these with -I and -L and
to LD_LIBRARY_PATH, etc.
If you want to see GCC's built in header search paths, etc., try
compiling something with GCC's -v switch.
> #include <myfile.h>
If you added the subdirectory name, i.e.
#include <myfiles/myfile.h>
it should have worked.
Rup.
More information about the Gcc-help
mailing list