clang错误:c ++ / 4.8 / bits / stl_iterator_base_types.h:227:29:错误:没有命名的类型&#39; iterator_category&#39; in&#39; std :: iterator_traits <unsigned long =“”>&#39; </unsigned>

时间:2015-03-08 16:31:57

标签: c++ gcc clang libc++

自定义构建的clang 3.1无法从libc ++中找到一些与机器相关的包含文件(如bits/c++config.h),因此我必须手动添加:-I/usr/include/x86_64-linux-gnu/c++/4.8到命令行。 gcc找到这些文件没有问题。

现在我正在尝试用clang ++编译一个文件。 gcc(使用相同的选项)编译它,只抱怨一堆警告,当clang ++无法做到这一点时,引用标准库中的错误:

In file included from /home/necto/proj/klein/lib/Core/PPLSupport.cpp:2:
In file included from /home/necto/proj/klein/build/llvm/include/llvm/Constant.h:17:
In file included from /home/necto/proj/klein/build/llvm/include/llvm/User.h:22:
In file included from /home/necto/proj/klein/build/llvm/include/llvm/Support/ErrorHandling.h:19:
In file included from /home/necto/proj/klein/build/llvm/include/llvm/ADT/StringRef.h:18:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/string:39:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/char_traits.h:38:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_algobase.h:65:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_iterator_base_types.h:227:29: error: no type named 'iterator_category' in 'std::iterator_traits<unsigned long>'
            iterator_traits<_InIter>::iterator_category,
            ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:391:25: note: in instantiation of template type alias '_RequireInputIter' requested here
           typename = std::_RequireInputIter<_InputIterator>>
                           ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:392:9: note: in instantiation of default argument for 'vector<unsigned long>' required here
    vector(_InputIterator __first, _InputIterator __last,
    ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:392:9: note: while substituting deduced template arguments into function template 'vector' [with _InputIterator = unsigned long, $1 = ]
    vector(_InputIterator __first, _InputIterator __last,

clang 3.1版 目标:x86_64-unknown-linux-gnu 线程模型:posix

gcc(Ubuntu 4.8.2-19ubuntu1)4.8.2

我应该如何进一步调查?哪些信息在这里有用?

1 个答案:

答案 0 :(得分:1)

升级clang版本,clang 3.1很可能无法处理4.8 libstdc++标题。

http://llvm.org/releases/download.html
http://llvm.org/apt