title: clang++ can not locate c++ header and library
body: <p>My OS is OS X 10.10.2 and the default compiler for C is clang.
  But this version of clang does not support ubsan (undefined sanitizer) which comes in the 3.4 release of clang. I also want to use KLEE to do some analysis. AFAIK KLEE works well with LLVM-&lt;=3.4. I decided to install 
  llvm-3.4 and clang-3.4 in my laptop.</p>
  
  <p>After installing clang-3.4 in my system, I encountered a issue that the compiler can not locate the c++ header file. I installed clang-3.4 in /usr/local and I can find the c++ header file in /usr/local/include/c++/4.8.4. How can I add this directory to the search path of clang-3.4 and also the c++ library? </p>
  
  <p>for the following demo code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  int main(){
      cout&lt;&lt;"Hellow World\n";
      return 0;
  }
  </code></pre>
  
  <p>When I compile it using command <code>clang++ test.cpp</code>, I got the error</p>
  
  <pre><code>test1.cpp:1:10: fatal error: 'iostream' file not found
  #include &lt;iostream&gt;
       ^
  1 error generated.
  </code></pre>
  
  <p>Below is the version of clang I used</p>
  
  <pre><code>clang version 3.4 (tags/RELEASE_34/final)
  Target: x86_64-apple-darwin14.1.0
  Thread model: posix
  </code></pre>
  
  <p>I used the following shell command to install llvm-3.4 and clang-3.4:</p>
  
  <pre><code>wget http://llvm.org/releases/3.4/llvm-3.4.src.tar.gz \
       http://llvm.org/releases/3.4/clang-3.4.src.tar.gz \
       http://llvm.org/releases/3.4/clang-tools-extra-3.4.src.tar.gz \
       http://llvm.org/releases/3.4/compiler-rt-3.4.src.tar.gz
  tar zxf llvm-3.4.src.tar.gz
  tar zxf clang-3.4.src.tar.gz -C llvm-3.4/tools
  mv llvm-3.4/tools/clang{-3.4,}
  tar zxf clang-tools-extra-3.4.src.tar.gz -C llvm-3.4/tools/clang/tools
  mv llvm-3.4/tools/clang/tools/{clang-tools-extra-3.4,extra}
  tar zxf compiler-rt-3.4.src.tar.gz -C llvm-3.4/projects
  mv llvm-3.4/projects/compiler-rt{-3.4,}
  
  cd llvm-3.4
  ./configure --enable-cxx11  \
                        --enable-bindings=none --enable-shared \
                        --enable-debug-symbols --enable-optimized
  make
  make install
  </code></pre>
  
  <p>Now I have two versions of clang in my OS, one is the default one shipped with OSX located in /usr/bin and the other is clang-3.4 located in /usr/local/bin. The previous one can find the C++ header file while the latter can not.</p>