Skip to content

[bazel.build] Problem with /start/cpp #26416

@MatthewJohnHeath

Description

@MatthewJohnHeath

Page link:

https://bazel.build/start/cpp

Problem description (include actual vs expected text, if applicable):

The tutorial doesn't run as expected with the current examples repo.
bazel build //main:hello-world
produces the response

ERROR: The 'build' command is only supported from within a workspace (below a directory having a WORKSPACE file).
See documentation at https://docs.bazel.build/versions/master/build-ref.html#workspace

After adding an empty WORKSPACE in cpp-tutorial/stage1 it gives

me:~/Documents/repos/examples/cpp-tutorial/stage1$ bazel build //main:hello-world
Starting local Bazel server and connecting to it...
ERROR: Skipping '//main:hello-world': error loading package 'main': cannot load '@rules_cc//cc:cc_binary.bzl': no such file
WARNING: Target pattern parsing failed.
ERROR: error loading package 'main': cannot load '@rules_cc//cc:cc_binary.bzl': no such file

Editing the BUILD file to be identical to the one in the tutorial fixed it

Where do you see this issue? (include link to specific section of the page, if applicable)

https://bazel.build/start/cpp#stage-1

Any other information you'd like to share?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions