Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/hello_world/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hello_world
hello_world.exe
17 changes: 17 additions & 0 deletions examples/hello_world/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CXX ?= g++
CXXFLAGS ?= -std=c++17 -Wall -Wextra -Werror -O2

.PHONY: all run test clean

all: hello_world

hello_world: main.cpp
$(CXX) $(CXXFLAGS) -o $@ main.cpp

run: hello_world
./hello_world

test: run

clean:
rm -f hello_world
19 changes: 19 additions & 0 deletions examples/hello_world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Hello World (C++)

A classic Hello World program that prints a greeting to stdout.

## Build and run

Requires a C++17 compiler (`g++` or `clang++`).

```bash
cd examples/hello_world
make run
```

Or without make:

```bash
g++ -std=c++17 -Wall -Wextra -Werror -O2 -o hello_world main.cpp
./hello_world
```
6 changes: 6 additions & 0 deletions examples/hello_world/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <iostream>

int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}