我的项目结构如下:
$ 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"],
)
如果我构建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
?