我的项目结构如下:
$ tree
.
├── bar
│ ├── bar.cpp
│ └── BUILD
├── BUILD
├── foo.cpp
└── WORKSPACE
内容./BUILD
:
cc_binary(
name = "foo",
srcs = [ "foo.cpp" ],
deps = [ "//bar" ],
)
内容bar/BUILD
:
cc_library(
name = "bar",
srcs = ["bar.cpp"],
)
如果我 build foo
,我会收到以下错误:
Target '//bar:bar' is not visible from target '//:foo'. Check the visibility declaration of the former target if you think the dependency is legitimate.
我需要做什么才能解决依赖关系并foo
成功构建?