<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>
    </p>
    <div class="moz-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/RecursiveASTVisitor.h"
      <br>
      #include "clang/Frontend/ASTConsumers.h"
      <br>
      #include "clang/Frontend/FrontendActions.h"
      <br>
      #include "clang/Frontend/CompilerInstance.h"
      <br>
      #include "clang/Tooling/CommonOptionsParser.h"
      <br>
      #include "clang/Tooling/Tooling.h"
      <br>
      #include "clang/Rewrite/Core/Rewriter.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/Contents/Developer/usr/bin/make" -f
      nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
      <br>
      "/Applications/Xcode.app/Contents/Developer/usr/bin/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/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/main.o.d" -o
      build/Debug/CLang-MacOSX/main.o main.cpp
      <br>
      In file included from main.cpp:2:
      <br>
      In file included from /usr/local/include/clang/AST/AST.h:18:
      <br>
      In file included from
      /usr/local/include/clang/AST/ASTContext.h:18:
      <br>
      In file included from
      /usr/local/include/clang/AST/ASTTypeTraits.h:20:
      <br>
      In file included from /usr/local/include/clang/AST/Decl.h:17:
      <br>
      In file included from /usr/local/include/clang/AST/APValue.h:17:
      <br>
      In file included from /usr/local/include/clang/Basic/LLVM.h:22:
      <br>
      In file included from
      /usr/local/include/llvm/Support/Casting.h:19:
      <br>
      In file included from
      /usr/local/include/llvm/Support/type_traits.h:18:
      <br>
      In file included from /usr/include/c++/4.2.1/utility:67:
      <br>
      /usr/include/c++/4.2.1/bits/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/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/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/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/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/stl_pair.h:97:40: 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/stl_pair.h:97:54: 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/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/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/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/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="moz-txt-slash"><span class="moz-txt-tag">/</span>usr/local/bin<span
          class="moz-txt-tag">/</span></i>../include/c++/v1/type_traits:393:1:
      note: '__1' declared here
      <br>
      _LIBCPP_BEGIN_NAMESPACE_STD
      <br>
      ^
      <br>
      <i class="moz-txt-slash"><span class="moz-txt-tag">/</span>usr/local/bin<span
          class="moz-txt-tag">/</span></i>../include/c++/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>
                                                                    ^
      <br>
      <i class="moz-txt-slash"><span class="moz-txt-tag">/</span>usr/local/bin<span
          class="moz-txt-tag">/</span></i>../include/c++/v1/__config:67:27:
      note: expanded from macro '_LIBCPP_NAMESPACE'
      <br>
      #define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_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/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>
      <br>
      <div class="moz-txt-sig"><span class="moz-txt-tag">-- <br>
        </span>
        <br>
        Paul
        <br>
        <br>
      </div>
    </div>
    <br>
    <pre class="moz-signature" cols="72">-- 

Paul</pre>
  </body>
</html>