{"id":31974453,"url":"https://github.com/nooneknowspeter/cpplings","last_synced_at":"2026-04-20T14:06:53.599Z","repository":{"id":297770679,"uuid":"987246859","full_name":"nooneknowspeter/cpplings","owner":"nooneknowspeter","description":"A terminal based learning experience for C++, inspired by Rustlings","archived":false,"fork":false,"pushed_at":"2026-03-17T19:27:41.000Z","size":192,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-18T09:10:21.578Z","etag":null,"topics":["cpp","zig","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nooneknowspeter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-20T19:44:27.000Z","updated_at":"2025-11-15T21:52:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"21b6d68f-de8b-487d-9116-5d72bcbf3e09","html_url":"https://github.com/nooneknowspeter/cpplings","commit_stats":null,"previous_names":["nooneknowspeter/cpplings"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nooneknowspeter/cpplings","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nooneknowspeter%2Fcpplings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nooneknowspeter%2Fcpplings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nooneknowspeter%2Fcpplings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nooneknowspeter%2Fcpplings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nooneknowspeter","download_url":"https://codeload.github.com/nooneknowspeter/cpplings/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nooneknowspeter%2Fcpplings/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32050454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","zig","ziglang"],"created_at":"2025-10-14T20:17:00.174Z","updated_at":"2026-04-20T14:06:53.579Z","avatar_url":"https://github.com/nooneknowspeter.png","language":"Zig","readme":"# cpplings\n\n**cpplings**, inspired by [Rustlings](https://github.com/rust-lang/rustlings),\nis a set of hands-on exercises to help you get comfortable reading\nand writing modern **C++**.\n\nThese exercises reference the excellent [learncpp](https://www.learncpp.com/)\nand are conceptually related to [cplings](https://github.com/rdjondo/cplings),\nwhich adopted this idea earlier.\n\nWe recommend doing these exercises alongside reading [learncpp](https://www.learncpp.com/)\nand checking out the additional learning resources listed below\nand in the comments of the source code.\n\n---\n\n## Why Zig?\n\nThis project uses **[Zig](https://ziglang.org/)** as a toolchain instead of CMake\nor any other build system used for C++ development.\nThis is a deliberate choice to test Zig’s practical usefulness in real-world C++ workflows.\n\n### Benefits of Using Zig\n\n- Zig is simple but powerful.\n- It ships with a Clang-based compiler toolchain built in.\n- It simplifies compiling for multiple architectures (x86, ARM, etc.).\n- It removes the pain of installing and managing compiler versions manually (GCC, Clang, etc.).\n- Zig-based builds are highly reproducible and consistent across platforms.\n\n\u003e [!NOTE]\n\u003e\n\u003e Although Nix technically solves the problem with managing dependencies and\n\u003e their versions, I strongly support using Zig over CMake\n\u003e as a toolchain for its vector processing (building wth SIMD)\n\u003e and for being an elegant and minimalistic language.\n\n---\n\n## Build \u0026 Setup\n\n\u003e [!NOTE]\n\u003e\n\u003e The binary can be found in `./zig-out/bin/cpplings_cli` after building `zig build` or running `zig build run`.\n\nStart by cloning this repository on your machine.\n\n\u003e [!NOTE]\n\u003e\n\u003e If you want to store and save your progress you can fork the repository or\n\u003e change the remote orgin URI to your own repository\n\nThis project uses a [`Makefile`](./Makefile) to simplify common development tasks.\nYou will need `make` installed on your system.\nIf you do not want to install make (make is provided in the Nix shell environment)\nor don't have it installed, you can use the commands specified in the [`Makefile`](./Makefile).\n\n### Native Package Manager\n\nIf you would like to compile using your own package manager; `homebrew`, `pacman`, `apt`, etc.\nYou can install the following:\n\n- clang-tools (clang-format)\n- gdb/lldb (debugging)\n- zig \u003e= 0.15.1\n\n### asdf-vm\n\nIf you're using [`asdf`](https://github.com/asdf-vm/asdf), you can install the dependencies using:\n\n```sh\nasdf install\n```\n\nCheck [`.tool-versions`](./.tool-versions) and ensure you have the plugins added such as:\n\n```sh\nasdf plugin add \u003cplugin-name\u003e\n```\n\n### Nix\n\nIf you're using NixOS or Nix installed, a flake based nix shell environment is provided with all required dependencies,\nsuch as Zig, and more.\n\n\u003e [!NOTE]\n\u003e\n\u003e If you do not have Nix installed, install it [here](https://nixos.org/download/).\n\u003e\n\u003e Ensure that you install the multi-user version of Nix.\n\n\u003e [!NOTE]\n\u003e\n\u003e If you do not want to install Nix on your system but have Docker installed and running,\n\u003e you can use the [Docker approach](#docker) which uses an Arch Linux container with Nix installed.\n\nStart the environment with:\n\n\u003e [!NOTE]\n\u003e\n\u003e Ensure you have extra-experimental features on with `experimental-features = nix-command flakes`\n\u003e in your `/etc/nix/nix.conf` or `~/.config/nix/nix.conf`\n\u003e\n\u003e or\n\u003e\n\u003e use it inline `nix --extra-experimental-features \"nix-command flakes\" develop`\n\n```sh\nnix develop\n```\n\nThis gives you a fully configured development shell without installing the dependencies globally on your system.\n\n\u003e [!NOTE]\n\u003e\n\u003e A `.envrc` is provided to allow the nix shell to be used automatically\n\u003e\n\u003e Make sure to have `direnv` installed and use `direnv allow` when in the project directory\n\u003e\n\u003e If it gets a little annoying, you can use `direnv disallow` to disable it and manually enter\n\u003e the shell with `nix develop`\n\nIf you are unfarmiliar with Nix,\nit is a package manager and system configuration tool.\nIt prevents the \"it works on my machine\" problem by allowing declerative and reproducible builds of environments.\n\nYou can read more about it [here](https://nixos.org/guides/how-nix-works/)\nand the extra experimental features (flakes) [here](https://nixos-and-flakes.thiscute.world/nixos-with-flakes/introduction-to-flakes).\n\n### Docker\n\nA `Dockerfile` is provided for containerized development.\n\nThe container is based off the Arch Linux image with a multi-user version of Nix installed.\n\nThe container is purely made for compiling, it uses a shared volume with the cpplings folder on your system.\nThis allows coding and editing to be done in a decoupled/modular way.\nIt can be done directly on your machine in the cpplings directory with the installed development\ntools on your system or another environment (Code editor running in another container or some sort of system).\n\nYou can build and run the container locally using:\n\n```sh\nmake docker-build \u0026\u0026 \\\nmake docker-run\n```\n\nThe image will be tagged as `cpplings`.\n\nThe container mounts your current project directory into `/cpplings` in the container.\n\nThis setup is ideal for isolated or reproducible builds.\n\nA pre-built image is also available via GitHub Container Registry by running:\n\n```sh\nmake docker-run\n```\n\n\u003e [!NOTE]\n\u003e\n\u003e If you would like to set up an environment as quick as possible and haven't cloned this repository, you can use:\n\u003e\n\u003e #### Unix\n\u003e\n\u003e ```sh\n\u003e # change CPPLINGS_DIR to your liking \\\n\u003e # example: ~/projects/cpplings or ~/git/cpplings \\\n\u003e export CPPLINGS_DIR=~/cpplings \u0026\u0026 \\\n\u003e export CPPLINGS_OCI_IMAGE_URL=ghcr.io/nooneknowspeter/cpplings:main \u0026\u0026 \\\n\u003e\n\u003e git clone https://github.com/nooneknowspeter/cpplings.git ${CPPLINGS_DIR} \u0026\u0026 \\\n\u003e cd ${CPPLINGS_DIR} \u0026\u0026 \\\n\u003e\n\u003e docker run -itd -v .:/cpplings --name cpplings ${CPPLINGS_OCI_IMAGE_URL} \u0026\u0026 \\\n\u003e\n\u003e # uncomment the line below if you're using VS Code \\\n\u003e # code . -r \u0026\u0026 \\\n\u003e # or replace command with editor of choice \\\n\u003e # nvim . \u0026\u0026 \\\n\u003e\n\u003e # execute the line below seperately (editor's terminal or seperate terminal instance)\n\u003e # if you are running the editor command above\n\u003e docker exec -it -w \"/cpplings\" cpplings bash\n\u003e ```\n\u003e\n\u003e #### Windows (Powershell)\n\u003e\n\u003e ```ps1\n\u003e # change CPPLINGS_DIR to your liking \\\n\u003e # example: $HOME\\projects\\cpplings or $HOME\\git\\cpplings \\\n\u003e $env:CPPLINGS_DIR = \"$HOME\\cpplings\"; \\\n\u003e $env:CPPLINGS_OCI_IMAGE_URL = \"ghcr.io/nooneknowspeter/cpplings:main\"; \\\n\u003e\n\u003e git clone https://github.com/nooneknowspeter/cpplings.git $env:CPPLINGS_DIR; \\\n\u003e cd $env:CPPLINGS_DIR; \\\n\u003e\n\u003e docker run -itd -v .:/cpplings --name cpplings $env:CPPLINGS_OCI_IMAGE_URL;\n\u003e\n\u003e # uncomment the line below if you're using VS Code \\\n\u003e # code . -r; \\\n\u003e # or replace command with editor of choice \\\n\u003e # nvim .; \\\n\u003e\n\u003e # execute the line below seperately (editor's terminal or seperate terminal instance)\n\u003e # if you are running the editor command above\n\u003e docker exec -it -w \"/cpplings\" cpplings bash\n\u003e ```\n\u003e\n\u003e Copy and paste, then edit to your liking.\n\u003e\n\u003e This will launch the shell of the container instantly, use it in your VS Code terminal,\n\u003e or a split pane if you're using terminal multiplexer, or just your terminal.\n\n\u003e [!NOTE]\n\u003e\n\u003e Run the container's shell using:\n\u003e\n\u003e ```sh\n\u003e docker exec -it -w \"/cpplings\" cpplings bash\n\u003e ```\n\n\u003e [!NOTE]\n\u003e\n\u003e Using `nix develop` will result in an ownership problem\n\u003e\n\u003e Inside the docker container's shell run:\n\u003e\n\u003e ```sh\n\u003e chown -R root:users /cpplings \u0026\u0026 \\\n\u003e chmod a+rwX /cpplings\n\u003e ```\n\u003e\n\u003e Enter inside the nix development shell using:\n\u003e\n\u003e ```sh\n\u003e nix develop\n\u003e ```\n\n\u003e [!NOTE]\n\u003e\n\u003e You may encounter a problem with not being able to execute a few commands such as `git` on your local machine\n\u003e because the owner of the folder will be root\n\u003e\n\u003e You will have to change the owner to your local machine's user `chown -R \u003cusername\u003e /path/to/cpplings`\n\n### Development Environment\n\n#### VS Code\n\nFor VS Code users who are unfirmiliar with C++, an [`extensions.json`](./.vscode/extensions.json) file is included.\nIt has the recommended extensions for writing and debugging C++, and the other tools in this project.\n\n#### Neovim\n\nFor Neovim users using Nix as their package manager (NixCats, etc.),\ncan use `nix develop` for a nix dev shell with all project related\nLSPs, DAPs, formatters and linters.\n\nIf you're on NixOS and still use Mason as a package manager for Neovim LSPs and so on,\nyou can still use this shell to install the required packages (clangd, zsl, ...) through Mason.\n\nYou can use whichever tools you prefer and may want to try.\n\nHave fun.\n\n---\n\n## Resources\n\n[learncpp](https://www.learncpp.com/) — Comprehensive and beginner-friendly C++ guide.\n\n[cppreference](https://en.cppreference.com/w/) — The canonical C++ reference.\n\n[cppbyexample](https://cppbyexample.com/) — C++ concepts via concise examples.\n\n[getcracked.io](https://www.getcracked.io/) — A platform to help prepare for interviews and understand low-level concepts,\nhas C++ questions and coding problems.\n\n[learnxinyminutes: C++](https://learnxinyminutes.com/docs/c++) — Fast language overview for experienced programmers.\n\n[zig's build system](https://ziglang.org/learn/build-system/) — Documentation on Zig's build system.\n\n[ziglings](https://codeberg.org/ziglings/exercises/) — Zig version of Rustlings, worth checking out if you're curious about Zig.\n\n[Maintain It With Zig](https://kristoff.it/blog/maintain-it-with-zig/) — A well written article by Loris Cro,\nexplaining the benefits of Zig's build system in the world of C/C++.\n\n[Why Zig When There is Already C++, D, and Rust?](https://ziglang.org/learn/why_zig_rust_d_cpp/) — Another article on the benefits of Zig.\n\n[allyourcodebase](https://github.com/allyourcodebase) - C/C++ projects built with Zig.\n\n[clangd compiler flags](https://simonhartcher.com/posts/2025-09-08-announcing-compile-flagz/) - Make Clangd work with C++ using Zig as a build system.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnooneknowspeter%2Fcpplings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnooneknowspeter%2Fcpplings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnooneknowspeter%2Fcpplings/lists"}