This repository is dedicated to learning C++ through the excellent tutorials at LearnCpp.com. It includes notes, code examples, and a custom script to compile and run C++ files easily from anywhere in your terminal.
- Understand modern C++ (C++17 and newer)
- Practice examples from LearnCpp.com
- Gain confidence using C++ compilers and debugging tools
- Develop good coding and build habits early
A handy Bash script is included to help compile and run .cpp
files in one command.
scripts/run_cpp.sh
- Make the script executable:
chmod +x scripts/run_cpp.sh
- Move it to a global directory so it can be used anywhere:
sudo mv scripts/run_cpp.sh /usr/local/bin/run_cpp
- Now you can run C++ files from any location like this:
run_cpp main.cpp
- Uses
g++
with-std=c++17
- Compiles file to a
.out
executable - Runs the program automatically after successful compilation
- Displays useful errors if the file is missing or fails to compile
run_cpp basics/hello.cpp
Sample output:
Compiling basics/hello.cpp -> basics/hello.out
Running basics/hello.out...
-------------------------------
Hello, world!
-
Ubuntu or Debian-based Linux system
-
g++
installed:sudo apt update && sudo apt install g++
.
├── basics/ # Code examples organized by topic
├── notes/ # Markdown notes per section
├── scripts/
│ └── run_cpp # Global compile & run script
└── README.md
Learning C++ can be overwhelming — this setup streamlines your environment so you can focus on coding and understanding rather than managing build tools.
This project is licensed under the MIT License.
Contributions are welcome! Feel free to open issues or submit pull requests with improvements, additional examples, or fixes.
---
Let me know if you'd like me to include a license file or generate any starter content like a `.gitignore`, sample directory layout, or C++ templates.