<div dir="ltr"><div>Hi Paul:</div><div><br></div>Why are you explicitly including .../c++/4.2.1? <div><br></div><div>If clang was compiled correctly, it should be able to find it's own c++ headers -- on OSX, that's most likely libc++ headers.  Try running:</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:1em;padding:5px;border:0px;font-size:13px;width:auto;max-height:600px;overflow:auto;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace,sans-serif;background-color:rgb(239,240,241);word-wrap:normal;color:rgb(36,39,41)"><code style="margin:0px;padding:0px;border:0px;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace,sans-serif;white-space:inherit">clang++ -v -c -x c++ - < /dev/null</code></pre></div><div class="gmail_extra"><div class="gmail_quote">hth...</div><div class="gmail_quote">don</div><div class="gmail_quote"><br></div><div class="gmail_quote">On Fri, Dec 23, 2016 at 10:12 AM, icloud via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  

    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <p>
    </p>
    <div class="m_-1924487469993077611moz-text-flowed" style="font-family:-moz-fixed;font-size:12px" lang="x-unicode">I am writing a parser for c++.
      <br>
      <br>
      I am developing on a Mac. OS X Sierra 10.12.1
      <br>
      <br>
      I am frustrated by the fact that I cannot compile even the
      simplest c++ code because clang 3.9 finds errors in the clang
      headers themselves! for example:
      <br>
      <br>
      #include "clang/AST/ASTContext.h"
      <br>
      #include "clang/AST/ASTConsumer.h"
      <br>
      #include "clang/AST/<wbr>RecursiveASTVisitor.h"
      <br>
      #include "clang/Frontend/ASTConsumers.<wbr>h"
      <br>
      #include "clang/Frontend/<wbr>FrontendActions.h"
      <br>
      #include "clang/Frontend/<wbr>CompilerInstance.h"
      <br>
      #include "clang/Tooling/<wbr>CommonOptionsParser.h"
      <br>
      #include "clang/Tooling/Tooling.h"
      <br>
      #include "clang/Rewrite/Core/Rewriter.<wbr>h"
      <br>
      #include "llvm/Support/raw_ostream.h"
      <br>
      #include <string>
      <br>
      #include <memory>
      <br>
      <br>
      <br>
      int main( void )
      <br>
      {
      <br>
          return 0;
      <br>
      }
      <br>
      <br>
      <br>
      ---
      <br>
      <br>
      My output from running make is:
      <br>
      <br>
      "/Applications/Xcode.app/<wbr>Contents/Developer/usr/bin/<wbr>make" -f
      nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
      <br>
      "/Applications/Xcode.app/<wbr>Contents/Developer/usr/bin/<wbr>make"  -f
      nbproject/Makefile-Debug.mk dist/Debug/CLang-MacOSX/parser
      <br>
      mkdir -p build/Debug/CLang-MacOSX
      <br>
      rm -f "build/Debug/CLang-MacOSX/<wbr>main.o.d"
      <br>
      clang++    -c -g -I/usr/local/include -I/usr/include/c++/4.2.1
      -I/usr/include/c++/4.2.1 -std=c++14 -MMD -MP -MF
      "build/Debug/CLang-MacOSX/<wbr>main.o.d" -o
      build/Debug/CLang-MacOSX/main.<wbr>o main.cpp
      <br>
      In file included from main.cpp:2:
      <br>
      In file included from /usr/local/include/clang/AST/<wbr>AST.h:18:
      <br>
      In file included from
      /usr/local/include/clang/AST/<wbr>ASTContext.h:18:
      <br>
      In file included from
      /usr/local/include/clang/AST/<wbr>ASTTypeTraits.h:20:
      <br>
      In file included from /usr/local/include/clang/AST/<wbr>Decl.h:17:
      <br>
      In file included from /usr/local/include/clang/AST/<wbr>APValue.h:17:
      <br>
      In file included from /usr/local/include/clang/<wbr>Basic/LLVM.h:22:
      <br>
      In file included from
      /usr/local/include/llvm/<wbr>Support/Casting.h:19:
      <br>
      In file included from
      /usr/local/include/llvm/<wbr>Support/type_traits.h:18:
      <br>
      In file included from /usr/include/c++/4.2.1/<wbr>utility:67:
      <br>
      /usr/include/c++/4.2.1/bits/<wbr>stl_pair.h:96:22: error: unknown type
      name 'pair'
      <br>
          operator==(const pair<_T1, _T2>& __x, const
      pair<_T1, _T2>& __y)
      <br>
                           ^
      <br>
      /usr/include/c++/4.2.1/bits/<wbr>stl_pair.h:96:26: error: expected ')'
      <br>
          operator==(const pair<_T1, _T2>& __x, const
      pair<_T1, _T2>& __y)
      <br>
                               ^
      <br>
      /usr/include/c++/4.2.1/bits/<wbr>stl_pair.h:96:15: note: to match this
      '('
      <br>
          operator==(const pair<_T1, _T2>& __x, const
      pair<_T1, _T2>& __y)
      <br>
                    ^
      <br>
      /usr/include/c++/4.2.1/bits/<wbr>stl_pair.h:97:14: error: use of
      undeclared identifier '__x'
      <br>
          { return __x.first == __y.first && __x.second ==
      __y.second; }
      <br>
                   ^
      <br>
      /usr/include/c++/4.2.1/bits/<wbr>stl_pair.h:97:27: error: use of
      undeclared identifier '__y'
      <br>
          { return __x.first == __y.first && __x.second ==
      __y.second; }
      <br>
                                ^
      <br>
      /usr/include/c++/4.2.1/bits/<wbr>stl_pair.h:97:40: error: use of
      undeclared identifier '__x'
      <br>
          { return __x.first == __y.first && __x.second ==
      __y.second; }
      <br>
                                    <wbr>         ^
      <br>
      /usr/include/c++/4.2.1/bits/<wbr>stl_pair.h:97:54: error: use of
      undeclared identifier '__y'
      <br>
          { return __x.first == __y.first && __x.second ==
      __y.second; }
      <br>
                                    <wbr>                       ^
      <br>
      /usr/include/c++/4.2.1/bits/<wbr>stl_pair.h:102:21: error: unknown type
      name 'pair'
      <br>
          operator<(const pair<_T1, _T2>& __x, const
      pair<_T1, _T2>& __y)
      <br>
                          ^
      <br>
      /usr/include/c++/4.2.1/bits/<wbr>stl_pair.h:102:25: error: expected ')'
      <br>
          operator<(const pair<_T1, _T2>& __x, const
      pair<_T1, _T2>& __y)
      <br>
                              ^
      <br>
      /usr/include/c++/4.2.1/bits/<wbr>stl_pair.h:102:14: note: to match this
      '('
      <br>
          operator<(const pair<_T1, _T2>& __x, const
      pair<_T1, _T2>& __y)
      <br>
                   ^
      <br>
      /usr/include/c++/4.2.1/bits/<wbr>stl_pair.h:103:26: error: use of
      undeclared identifier '__y'; did you mean '__1'?
      <br>
          { return __x.first < __y.first
      <br>
                               ^
      <br>
      <i class="m_-1924487469993077611moz-txt-slash"><span class="m_-1924487469993077611moz-txt-tag">/</span>usr/local/bin<span class="m_-1924487469993077611moz-txt-tag">/</span></i>../include/c++/<wbr>v1/type_traits:393:1:
      note: '__1' declared here
      <br>
      _LIBCPP_BEGIN_NAMESPACE_STD
      <br>
      ^
      <br>
      <i class="m_-1924487469993077611moz-txt-slash"><span class="m_-1924487469993077611moz-txt-tag">/</span>usr/local/bin<span class="m_-1924487469993077611moz-txt-tag">/</span></i>../include/c++/<wbr>v1/__config:353:69:
      note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_STD'
      <br>
      #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline
      namespace _LIBCPP_NAMESPACE {
      <br>
                              <wbr>                              <wbr>        ^
      <br>
      <i class="m_-1924487469993077611moz-txt-slash"><span class="m_-1924487469993077611moz-txt-tag">/</span>usr/local/bin<span class="m_-1924487469993077611moz-txt-tag">/</span></i>../include/c++/<wbr>v1/__config:67:27:
      note: expanded from macro '_LIBCPP_NAMESPACE'
      <br>
      #define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_<wbr>VERSION)
      <br>
                                ^
      <br>
      ... and so on ... until:
      <br>
      <br>
      fatal error: too many errors emitted, stopping now
      [-ferror-limit=]
      <br>
      20 errors generated.
      <br>
      make[2]: *** [build/Debug/CLang-MacOSX/<wbr>main.o] Error 1
      <br>
      make[1]: *** [.build-conf] Error 2
      <br>
      make: *** [.build-impl] Error 2
      <br>
      <br>
      If I were to take a completely wild stab in the dark I would say
      clang thinks I'm compiling C code, not C++.
      <br>
      <br>
      maybe some missing extern "C"{  statements?
      <br>
      <br>
      Help will be greatly appreciated.
      <br><span class="HOEnZb"><font color="#888888">
      <br>
      <div class="m_-1924487469993077611moz-txt-sig"><span class="m_-1924487469993077611moz-txt-tag">-- <br>
        </span>
        <br>
        Paul
        <br>
        <br>
      </div>
    </font></span></div><span class="HOEnZb"><font color="#888888">
    <br>
    <pre class="m_-1924487469993077611moz-signature" cols="72">-- 

Paul</pre>
  </font></span></div>

<br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>