public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Simon, Jb" <jb.simon@lmco.com>
To: gcc-help@gcc.gnu.org
Subject: gcc include search order
Date: Thu, 07 Aug 2008 04:02:00 -0000	[thread overview]
Message-ID: <3BE9E6535E3029448670913581E7A1A20D852173@emss35m06.us.lmco.com> (raw)


Hi.
In my unit testing I need to change some header files (target is
vxWorks, which supports some things that the sun does not). 
So, what I do is fetch the development tree, and then in a new unit test
directory I attempt to compile the unit under test. Since this is NOT
vxworks, I use sed to change some of the .h files and put them in a
./changed directory.

When I try to compile the file, it is still using the .h file from the
original location, even though I have listed the include path for
./changed before the include path for the development tree.

Here is a partial output from gcc using the -v option

GNU CPP version 3.1 (cpplib) (sparc ELF)
GNU C++ version 3.1 (sparc-sun-solaris2.8)
        compiled by GNU C version 3.1.
ignoring nonexistent directory "NONE/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 changed
 /export/home4/xxx/yyyy/builds/int_rel5_latest/src/mp/interface
 /export/home4/xxx/yyyy/builds/int_rel5_latest/src/ap/app
 /export/home4/xxx/yyyy/builds/int_rel5_latest/src/shared/common
 /export/home4/xxx/yyyy/builds/int_rel5_latest/src/shared/interface
 /usr/local/include/g++-v3
 /usr/local/include/g++-v3/sparc-sun-solaris2.8
 /usr/local/include/g++-v3/backward
 /usr/local/include
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.1/include
 /usr/local/sparc-sun-solaris2.8/include
 /usr/include
End of search list.

I know the changed file is correct and that the include is not working
as expected, because when I copy the file from ./changed, back into the
development tree, the compilation works as expected.

One more bit of information. The source that I cam compiling is in
/export/home4/xxx/yyyy/builds/int_rel5_latest/src/ap/app
And it is including files from
/export/home4/xxx/yyyy/builds/int_rel5_latest/src/shared/common
These include files should be including the files from ./changed (when
they exist) but they are ignoring the .h files in the ./changed
directory and are instead using other, unchanged files in the
/export/home4/xxx/yyyy/builds/int_rel5_latest/src/shared/common
directory.

The gcc command line is something like

  TEST_DIR="."
  
  CHANGED_DIR_NAME=changed
  CHANGED_FILES_DIR=${TEST_DIR}/${CHANGED_DIR_NAME}

  CICU_HEADER_FILES="-I ${AP_INTERFACE_FILES} -I ${AP_APP_FILES} -I
${SHARED_COMMON_FILES} -I ${SHARED_INTERFACE_FILES}"
  
  HEADERS="-I ./ -I ${CHANGED_FILES_DIR} ${CICU_HEADER_FILES}"
  DEFINES="-DSUNRUN -DA10_DEBUG -DJOETEST"
  
  CFLAGS="-v -c -g -O1 -pipe -Wformat -Wunused -Wuninitialized -Wshadow
-Wmissing-prototypes -Wmissing-declarations"
  
  printf "Compiling the UUT File\n"
  gcc -fprofile-arcs -ftest-coverage ${CFLAGS} ${HEADERS} ${DEFINES}
${AP_APP_FILES}/unitUnderTest.cpp 


I hope this explanation is clear. If anyone knows how to fix the command
line so that it gets the .h files in the "changed" directory are used
instead of files in the other include directories.

Thanks
Joe

----------------------------------------------------
Time Flies like an Arrow. Fruit Flies like a Banana
 

             reply	other threads:[~2008-08-07  3:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-07  4:02 Simon, Jb [this message]
2008-08-07 16:30 ` Eljay Love-Jensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3BE9E6535E3029448670913581E7A1A20D852173@emss35m06.us.lmco.com \
    --to=jb.simon@lmco.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).