bazelbuild / bazelbuild/bazel

Documentation issue: Common C Build Use Cases

Open
#13,508 0 comments 0 reactions 0 assignees View on GitHub
help wanted P3 team-Documentation team-Rules-CPP type: documentation (cleanup)
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

Documentation URL: https://docs.bazel.build/versions/4.1.0/cpp-use-cases.html

The sections `Including external libraries` and `Writing and running C++ tests` are untestable in the current state.

1. The `./test/hello-test.cc` file includes `#include "lib/hello-greet.h"`, but nowhere was hello-greet mentioned. I guessed it was referring to the structure in [stage3 of the previous tutorial](https://docs.bazel.build/versions/4.1.0/tutorial/cpp.html#refine-your-bazel-build), but `hello-greet.h` in that tutorial is in `main/` and not `/lib`.

I ended up creating a directory structure like

![image](https://user-images.githubusercontent.com/9342524/119233944-47410a80-baf9-11eb-9089-d62458464127.png)

which managed to work, but it would be nice to add this to the [github cpp-tutorial](https://github.com/bazelbuild/examples/tree/master/cpp-tutorial), maybe as a 4th stage.

2. The other problem is that the first WORKSPACE + gtest.BUILD (without the strip_prefix) in https://docs.bazel.build/versions/4.1.0/cpp-use-cases.html#including-external-libraries didn't compile for me. I get the error:

![image](https://user-images.githubusercontent.com/9342524/119234020-a010a300-baf9-11eb-8c1d-3f5b00d0278a.png)

Contributor guide

Open the contributing guide

Research direction

Start with the Common C++ Build Use Cases page, especially the “Including external libraries” and “Writing and running C++ tests” sections, and compare them with the github cpp-tutorial stages. Reproduce the hello-greet layout and the WORKSPACE/gtest.BUILD example, then update the documentation or tutorial so both examples compile and their required file structure is explicit.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.