从gcc-7.1更新到gcc-7.2后,我对标准库标题的未声明包含有很多错误。例如
$ bazel build //test:my_test
ERROR: /home/haining/my_project/BUILD:39:1: undeclared inclusion(s) in rule '//test:my_test':
this rule is missing dependency declarations for the following files included by 'test/test_range.cpp':
'/home/haining/gcc-7.2/include/c++/7.2.0/cstddef'
'/home/haining/gcc-7.2/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/c++config.h'
'/home/haining/gcc-7.2/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/os_defines.h'
'/home/haining/gcc-7.2/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/cpu_defines.h'
'/home/haining/gcc-7.2/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/stddef.h'
'/home/haining/gcc-7.2/include/c++/7.2.0/functional'
'/home/haining/gcc-7.2/include/c++/7.2.0/bits/stl_function.h'
'/home/haining/gcc-7.2/include/c++/7.2.0/bits/move.h'
'/home/haining/gcc-7.2/include/c++/7.2.0/bits/concept_check.h'
'/home/haining/gcc-7.2/include/c++/7.2.0/type_traits'
'/home/haining/gcc-7.2/include/c++/7.2.0/backward/binders.h'
'/home/haining/gcc-7.2/include/c++/7.2.0/new'
'/home/haining/gcc-7.2/include/c++/7.2.0/exception'
... etc ...
如何解决此问题
答案 0 :(得分:3)
每当你对Bazel无法知道的系统进行操作时,运行bazel clean --expunge
是个好主意。这只是一种更有礼貌的方式rm -rf ~/.cache/bazel
:)
答案 1 :(得分:0)
不确定这是否是正确的解决方案,但我能够通过删除我的整个bazel缓存目录来实现这一点
$ rm -rf ~/.cache/bazel
我不确定这有什么其他影响,可能还有更好的东西,我的感觉就像一把大锤