Preprocessor gcc and override

B

bigbinc

I am trying to override all system includes. But I cant be sure that
they are overridden. I could use #include "stdio.h" as opposed to the
<stdio.h>
for example but I am working with a lot of code and have to redo my
includes.

So the question, If I have a

#include <stdio.h> in my code and
then I do

gcc -I.my_own_include/(has stdio.h)

which stdio.h will the code compile with
/usr/include/stdio.h or

my_own_include/stdio.h?

-I dir
Add the directory dir to the list of directories to be searched for
header files. Directories named by -I are searched before the standard
system include directories. If the directory dir is a standard system
include directory, the option is ignored to ensure that the default
search order for system directories and the special treatment of
system headers are not defeated .
 
R

Ron Natalie

bigbinc said:
I am trying to override all system includes. But I cant be sure that
they are overridden.

Where the include files come from is implementation dependent. Redefining
what is a system library feature is WAY OUTSIDE the realm of the language
(i.e., as far as the language is concerned, you can't do it).

You might ask in a gnu.* group covering gcc.
 
J

Jacques Labuschagne

bigbinc said:
-I dir
Add the directory dir to the list of directories to be searched for
header files. Directories named by -I are searched before the standard
system include directories. If the directory dir is a standard system
include directory, the option is ignored to ensure that the default
search order for system directories and the special treatment of
system headers are not defeated .

Directories named with -I are searched first, as the snippit of the info
page tells you. GCC uses the first file that matches. In future, please
ask GCC questions in a GCC group.

Jacques.
 

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

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top