I'm new to both FlatBuffers and Bazel. Can anyone post a minimal example for compiling flatc itself, the monster_generated.h file, and then sample_text.cpp?
When I run:
- bazel build flatbuffers:flatc
I get the following error:
- Unable to find package for @rules_cc//cc:defs.bzl: The repository '@rules_cc' could not be resolved.
I then build flatc with CMake temporarily, and moved on to building sample_text.cpp with Bazel. I thought I found a minimal example here:
However, when I run:
- bazel build flatbuffers-bazel:sample_binary
I get:
- fatal error: 'monster_generated.h' file not found
When I cheat and bring a copy of monster_generated.h (manually made with flatc, itself compiled with CMake) into the workspace, and add it to the srcs section of BUILD, I then get:
- every rule of type cc_flatbuffers_compile implicitly depends upon the target '@flatbuffers//:flatc', but this target could not be found because of: no such package '@flatbuffers//': The repository '@flatbuffers' could not be resolved
This is probably a basic issue since it does appear that Bazel is supported, so any advice is very welcome!
Thanks,
Sean