clang++ include path problem

Hi,

I’m using clang++ -### to get the -cc1 command I can add my own -cc1 options to. Unfortunately, the command I’m getting contains wrong include paths.

I have CPPFLAGS and LDFLAGS all set with the correct include paths. Which variable do I need to set for this to work correctly?

Thanks!

Gabor

You would append some codes to your source program like this:
HeaderSearchOptions &headerSearchOptions = rv.ci->getHeaderSearchOpts();
headerSearchOptions.AddPath("/usr/include",
          clang::frontend::System,
          false,
          false,
          false);

Hi Rambo,

Thanks for the reply, but that does not help me. Please read the question through before answering.

Gabor

Hi,

I’m using clang++ -### to get the -cc1 command I can add my own -cc1 options to. Unfortunately, the command I’m getting contains wrong include paths.

I have CPPFLAGS and LDFLAGS all set with the correct include paths. Which variable do I need to set for this to work correctly?

You need to pass your CPPFLAGS to clang yourself:

clang++ $CPPFLAGS …

The passing of $CPPFLAGS to the preprocessor is typically performed by the build system (eg make), not by the compiler itself. See http://www.gnu.org/software/make/manual/make.html#Catalogue-of-Rules