Domanda

How can I query the default include path of clang/clang++? I am trying to use a custom built clang compiler (the one that supports OpenMP), but it doesn't seem to find the STL libraries:

/usr/local/bin/clang++ hello.cpp 
hello.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
     ^
1 error generated.

By using an IDE, back-tracking the #include iostream, and finally using the -isystem option I got the simple helloworld application to compile in OSX 10.9:

/usr/local/bin/clang++ -isystem /Library/Developer/CommandLineTools/usr/lib/c++/v1 hello.cpp

Thanks for your help!

È stato utile?

Soluzione

You are looking for option -v. Compiling with clang++ -c file.cc -v will print among other things:

#include "..." search starts here:
#include <...> search starts here:
 /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9

etc.

Altri suggerimenti

If you run

clang++ -### hello.cpp

It will display the commands used to compile that particular file, including the default include paths, library search paths, targets etc.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top