This repository contains a collection of C++ sample topics, organized by folders within a Visual Studio Code workspace. Each folder represents a unique topic and includes all necessary resources for building and running the sample code. Once you are done reading this README, open the Basics.code-workspace to be able to use all of the pre-built tasks associated with each folder.
- Platform Support: Buildable on macOS, Windows, and Linux.
- Per-Folder Tasks: Each topic folder has its own
tasks.json
file to simplify the build process. - Clang++ Compiler: All samples are configured to build using the
clang++
compiler. - VS Code Integration: Easily build topics using the Command Palette in VS Code.
- Visual Studio Code: Ensure you have VS Code installed.
- C++ Compiler: Install
clang++
and ensure it is in your system's PATH.- macOS: Pre-installed or install via Xcode command-line tools.
- Windows: Install via LLVM.
- Linux: Install via your package manager (e.g.,
sudo apt install clang
on Ubuntu).
git clone https://github.com/erikbjur/CPP-Class.git
cd CPP-Class
- Open the cloned repository in VS Code.
- Ensure the workspace file (
*.code-workspace
) is selected.
Each folder contains its own tasks.json
file with tasks pre-configured for macOS, Windows, and Linux.
- macOS/Linux: Use the
Mac
tasks. - Windows: Use the
Windows
tasks.
- Open the Command Palette (
Ctrl+Shift+P
orCmd+Shift+P
on macOS). - Select
Tasks: Run Task
. - Choose the folder (topic) you want to build.
- Select the appropriate build task for your platform.
After building, the compiled executable will be available in the same folder. Run it using the terminal:
./executable-name # macOS/Linux
executable-name.exe # Windows
Each folder corresponds to a sample topic and contains:
- Source Files:
.cpp
files for the sample code. - tasks.json: Pre-configured build tasks.
- README.md (optional): Topic-specific documentation.
Contributions are welcome! To contribute:
- Fork this repository.
- Create a branch for your changes:
git checkout -b feature-name
. - Commit your changes:
git commit -m "Add new sample topic"
. - Push the branch:
git push origin feature-name
. - Open a Pull Request.
This project is licensed under the MIT License.
If you encounter any issues, please open an issue on GitHub.
- Thanks to the creators of Clang++ and Visual Studio Code for their awesome tools.