File: hello-world.cc

package info (click to toggle)
bazel-bootstrap 4.2.3%2Bds-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 85,476 kB
  • sloc: java: 721,710; sh: 55,859; cpp: 35,359; python: 12,139; xml: 295; objc: 269; makefile: 113; ansic: 106; ruby: 3
file content (26 lines) | stat: -rwxr-xr-x 747 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "examples/cpp/hello-lib.h"

#include <string>

using hello::HelloLib;
using std::string;

/**
 * This prints "Hello world". If it is run with arguments, it will use the first
 * argument instead of "world". Build and run //examples/cpp:hello-world to see
 * this program in action.
 *
 * This file does double-duty as a "test." It is a cc_binary, so it can also be
 * compiled as a cc_test and Bazel will decide on whether it passed or failed
 * based on exit code (which is always 0 here, so the test "passes"). See
 * hello-fail.cc for an example of making a test fail.
 */
int main(int argc, char** argv) {
  HelloLib lib("Hello");
  string thing = "world";
  if (argc > 1) {
    thing = argv[1];
  }
  lib.greet(thing);
  return 0;
}