Search code examples
c++clanginclude-pathabstract-syntax-tree

clang -cc1 and system includes


I have the following file foo.cpp:

#include <vector>

struct MyClass
{
  std::vector<int> v;
};

It can be successfully compiled with clang (I'm using clang 3.3 on Ubuntu 13.04 32bit):

clang++ -c foo.cpp

Now I want to print AST:

clang++ -cc1 -ast-print foo.cpp

and I've got the following error

foo.cpp:1:10: fatal error: 'vector' file not found
#include <vector>
         ^
struct MyClass {
};
1 error generated.

It looks like clang++ -cc1 doesn't know about system include files etc. I'm wondering how to set up includes for clang++ -cc1?


Solution

  • It's a Frequently Asked Question