首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >bazel中的“未声明的包含”,子目录中有标题

bazel中的“未声明的包含”,子目录中有标题
EN

Stack Overflow用户
提问于 2018-01-05 15:23:43
回答 1查看 1.2K关注 0票数 0

我正在尝试在一个ArduinoJson bazel项目中使用C++。它是一个只有头的库,在src下的子目录中有标头。但是我得到了一个未声明的包含错误。

//Third-Party/ArduinoJson cc_library def是这样的:

代码语言:javascript
复制
cc_library(
    name = "ArduinoJson",
    hdrs = glob(["5.12.0/src/**"]),
    includes = [
        "5.12.0/src",
        "5.12.0/src/ArduinoJson",
    ],
    visibility = ["//visibility:public"],
)

使用它的目标(序列化)确实在它的deps中有//Third-Party/ArduinoJson

以下是错误:

代码语言:javascript
复制
ERROR: /[...]/Serialization/BUILD:1:1: undeclared inclusion(s) in rule '//[...]/Serialization:Serialization':
this rule is missing dependency declarations for the following files included by '[...]/Serialization/JsonDeserializer.cpp':
  '[...]/Third-Party/ArduinoJson/5.12.0/src/ArduinoJson/Data/Encoding.hpp'
  '[...]/Third-Party/ArduinoJson/5.12.0/src/ArduinoJson/Serialization/FloatParts.hpp'
  '[...]/Third-Party/ArduinoJson/5.12.0/src/ArduinoJson/Polyfills/math.hpp'
  '[...]/Third-Party/ArduinoJson/5.12.0/src/ArduinoJson/TypeTraits/FloatTraits.hpp'
Target //[...]/Serialization:Serialization failed to build

因为它只是在抱怨src子目录中的文件,例如src/Data/Encoding.hpp,我猜这可能和它有关吧?

这不是"How to resolve bazel “undeclared inclusion(s)” error?"的复制,因为这个问题是通过执行我已经使用deps所做的事情来解决的。

EN

回答 1

Stack Overflow用户

发布于 2018-01-10 07:13:46

确保Third-Party/ArduinoJson的子目录中没有构建文件,否则Bazel将这些文件视为包,而glob不会从它们中提取文件。

如果在这些子目录中有构建文件,则需要在这些子目录中创建cc_library规则,导出//Third-Party/ArduinoJson:ArduinoJson中所需的头部,并依赖于来自ArduinoJson的这些cc_libraries。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48116530

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档