getting g++ to search correct include directory

C

Charles Herman

I am using the following flags for the g++ command

-I/usr/local/gcc-3.3/include/c++/3.3 -I/usr/local/include/g++-3

But istead of searching the first directory first, it searches the second
directory first. When I interchange the directories, it still searches
/usr/local/include/g++-3 first. How can I force it to search in the order I
want?

When I do not include any -I flag in the g++ commnand, it searches only
/usr/local/gcc-3.3/include/c++/3.3

-charles
 
G

Gianni Mariani

Charles said:
I am using the following flags for the g++ command

-I/usr/local/gcc-3.3/include/c++/3.3 -I/usr/local/include/g++-3

But istead of searching the first directory first, it searches the second
directory first. When I interchange the directories, it still searches
/usr/local/include/g++-3 first. How can I force it to search in the order I
want?

When I do not include any -I flag in the g++ commnand, it searches only
/usr/local/gcc-3.3/include/c++/3.3

-charles

This is a standard C++ NG. Nothing to do with g++ specifics.

BTW - the problem you might be having is that g++ will look in a few
standard places before it starts looking at -I's. You can change that
behaviour by:



-nostdinc
Do not search the standard system directories for
header files. Only the directories you have specified
with -I options (and the directory of the current
file, if appropriate) are searched.

-nostdinc++
Do not search for header files in the C++-specific
standard directories, but do still search the other
standard directories. (This option is used when
building the C++ library.)

....

all available with a "man g++" !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top