gpt4 book ai didi

c++ - clang 错误 : c++/4. 8/bits/STL_iterator_base_types.h:227:29: 错误: 'iterator_category' 中没有名为 'std::iterator_traits' 的类型

转载 作者:行者123 更新时间:2023-11-28 06:23:32 26 4
gpt4 key购买 nike

自定义构建的 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

海湾合作委员会(Ubuntu 4.8.2-19ubuntu1)4.8.2

我应该如何进行进一步调查?什么信息在这里有用?

最佳答案

升级你的clang版本,clang 3.1很可能无法处理4.8 libstdc++头文件。

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

关于c++ - clang 错误 : c++/4. 8/bits/STL_iterator_base_types.h:227:29: 错误: 'iterator_category' 中没有名为 'std::iterator_traits<unsigned long>' 的类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28928919/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com