c++ - 更新 gcc 后出现 bazel "undeclared inclusion(s)"错误

标签 c++ bazel

从 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 ...

我该如何解决这个问题

最佳答案

每当您对系统执行 Bazel 不可能知道的操作时,最好运行 bazel clean --expunge。这只是一种更礼貌的方式 rm -rf ~/.cache/bazel :)

关于c++ - 更新 gcc 后出现 bazel "undeclared inclusion(s)"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48155976/

相关文章:

bazel - 如何查找 bazel 之前运行的日志

bazel - 如何在 bazel 中保留 proto 文件的生成源代码?

c++ - 初始化一个 GLfloat

C++/Qt - 可选参数默认为 NULL

java - 如何在android中导入特定版本的 Fabric

c++ - 如何强制 Bazel 将库路径设置为所需的路径?

python - 从源构建 TensorFlow 时,生成 `gen_io_ops.py` 文件的 bazel 规则在哪里?

c++ - 在 const 方法中更改对象状态

c++ - opencv c++ 中的鼠标事件

c++ - Xlib 测试窗口名称