58Chapter3 Compilers and Assemblers
/opt/gcc-3.0.4/include
/opt/gcc-3.0.4/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/
include
/usr/include
You can place include files in other directories if you have set the
C_INCLUDE_PATH
environment variable. Setting this variable to
/opt
using the following command will include
/
opt
directory also in the search list. Also note that order is once again extremely important.
export C_INCLUDE_PATH=/opt
If you again execute the
gcc v E
command,
/opt
path will be included in the last
part of the output.
To set additional include paths permanently for all users, it is a good idea to add a line with
the export command in
/etc/profile
file.
3.2.4.4Setting Manual Pages Path
To be able to use manual pages installed with GCC, you have to add a line in the
/etc/
man.config
file. This will enable the
man
command to also look into the
/opt/gcc-
3.0.4/man
directory when searching for manual pages. The line looks like the following:
MANPATH /opt/gcc-3.0.4/man
Location of this line with respect to other
MANPATH
entries is important. If you put this
line after other entries, you will still get the same old man pages. That is why it is recommended
to put this entry BEFORE any other line that starts with
MANPATH
keyword in this file.
3.2.5What Not to Do when Installing Development Tools
When building GCC, dont build it into the source directory. I would also recommend not
installing your development tools in the default location (under
/usr/local
). Instead use
some place under the
/opt
directory. This way if something goes wrong, you can just delete
this directory under /opt without making any other change in the system. If you install these
tools in the default location, you may overwrite some existing files and may not be able to
reverse the installation process.
3.3Compiling a Program
The GCC compiler is commonly invoked using the
gcc
command. The command accepts many
command line switches that can be used to invoke different options for the compilation process.
You can use the same command line switch multiple times. For example, if you need to specify
multiple include paths, you can use
I
option multiple times. However you cant combine two
switches into one. For example
c
and
o
cant be combined as
co
. This section provides
information about different methods of compilation and things you need to consider in the com-
pilation process. Please note that in most of software development projects, you dont invoke
gcc
from the command line. Instead, the GNU
make
utility that reads one or many Makefiles
Next Page >>
<< Previous Page
Back to the Table of Contents