cpoach is a support tool designed to simplify the use of single-file C/C++ libraries. These libraries can be effortlessly installed via npm, making it easier to integrate them into your projects without the hassle of managing build systems (rather, just like #include <stdio.h>), and without including the third-party libraries into the project's version control. This is mainly to facilitate in-class demonstrations and assignments.
The name cpoach is a playful nod to the idea of poaching awesome C/C++ libraries and making them easily accessible for educational purposes. Many of these libraries are listed in r-lyeh/single_file_libs, fffaraz/awesome-cpp, or p-ranav/awesome-hpp. I was listening to Eskil Steenberg's talk on Advanced C, which you should also look into. He also has a collection of C libraries that you may want to explore.
Issues or suggestions regarding a specific library should be directed to the original library repository. However, for issues to the cpoach project, please open an issue here.
To install cpoach, use the following command:
$ npm i -g cpoach.shAfter installation, you can include the desired libraries in your C/C++ projects. For example, if you want to use the tigr.c library for graphics, follow these steps:
Run:
$ npm i tigr.cAnd then include tigr.h as follows:
// main.c
#define TIGR_IMPLEMENTATION
#include <tigr.h>
int main() { /* ... */ }And then compile with clang or gcc as usual.
$ clang $(cpoach i) main.c # or, use gcc
$ gcc $(cpoach i) main.c$ cpoach [command] [options]
Usage: cpoach [command] [options]
Commands:
i | includes Generate compiler flags for include paths.
Options:
--compiler [name] Specify the compiler (msvc, gcc, clang). Default is gcc.
--msvc Shortcut for --compiler msvc.
--gcc Shortcut for --compiler gcc.
--clang Shortcut for --compiler clang.
--help Display help information.Below is a categorized list of single-file C/C++ libraries available through the cpoach project:
🍳 Army knives
| Package | Description |
|---|---|
| ⚙️ boost.cxx | A collection of high-quality, free, and open-source libraries that extend the functionality of the C++ programming language; Dawes et al. (1998). |
| ⚙️ stb.c | stb single-file public domain libraries for C/C++; Sean Barrett (2014). |
| ⚙️ plibsys.c | Highly portable C system library: threads and synchronization primitives, sockets (TCP, UDP, SCTP), IPv4 and IPv6, IPC, hash functions (MD5, SHA-1, SHA-2, SHA-3, GOST), binary trees (RB, AVL) and more. Native code performance; Alexander Saprykin (2010). |
| ⚙️ libgb.c | gb single-file public domain libraries for C & C++; gingerBill (2015). |
| ⌛ prideout.c | single-file C libraries from Philip Allan Rideout; Philip Rideout (2015). |
🍳 High Performance Computing (HPC)
| Package | Description |
|---|---|
| ⚙️ taskflow.cxx | A General-purpose Task-parallel Programming System using Modern C++; Tsung-Wei Huang (2018). |
| ⚙️ subprocess.c | 🐜 Single header process launching solution for C and C++; Neil Henning (2017). |
| ⚙️ tinycthread.c | Small, portable implementation of the C11 threads API; Evan Nemerson (2012). |
| ⚙️ pthreads4w.c | POSIX threads API for Windows from https://sourceforge.net/p/pthreads4w; Ben Elliston (1998). |
| ⚙️ minicoro.c | Single header stackful cross-platform coroutine library in pure C; Eduardo Bart (2021). |
| ⚙️ cds_sync.c | Single-header C90 collection of synchronization primitives; Cort Stratton (2015). |
| ⚙️ buddy_alloc.c | A single header buddy memory allocator for C & C++; Stanislav Paskalev (2021). |
| ⚙️ rfft.c | Reasonably fast Fourier transform in a single header for C and C++; grego (2023). |
| ⚙️ xxhash.c | Extremely fast non-cryptographic hash algorithm; Yann Collet (2012). |
| ⚙️ linmath.c | A lean linear math library, aimed at graphics programming. Supports vec3, vec4, mat4x4 and quaternions; Wolfgang Draxinger (2013). |
| ⚙️ algebra3.cxx | Vector utilities for 2, 3, and 4 element vectors, all inline; Jean-Francois Doue, Paul S. Heckbert, and J. Nagle (1993). |
| ⚙️ stb_stats.c | Single header file with a bunch of useful statistical functions such as ANOVA, Kruskal-Wallis, T-test, etc; Gerben Voshol (2018). |
| ⚙️ cxxgraph.cxx | Header-Only C++ Library for Graph Representation and Algorithms; ZigRazor (2020). |
| ⌛ opencl.c | C/C++ language headers for the OpenCL API; The Khronos Group (2013). |
| ⌛ clew.c | The OpenCL Extension Wrangler Library; Martijn Berger (XXXX). |
| ⌛ bikeshed.c | Lock free hierarchical work scheduler; Dan Engelbrecht (2019). |
| ⌛ jemalloc.c | jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support; Jason Evans (XXXX). |
| ⌛ genann.c | simple neural network library in ANSI C; Lewis Van Winkle (2016). |
| ⌛ kann.c | A lightweight C library for artificial neural networks; Attractive Chaos (2016). |
| ⌛ robin-map.cxx | C++ implementation of a fast hash map and hash set using robin hood hashing; Thibaut Goetghebuer-Planchon (XXXX). |
| ⌛ uthash.c | C macros for hash tables and more; Troy D. Hanson (2005). |
| ⌛ cephes.c | Mirror of the Cephes C source for reference; Stephen L. Moshier (XXXX). |
| ⌛ hypatia.c | A header-only, pure-C math library for 2D/3D graphics (matrix, vector, quaternion) Seeks to be close to C89/C90 compliant for portability. It's like a BLAS, but easier to use; Darryl T. Agostinelli (2015). |
| ⌛ handmademath.c | A simple math library for games and computer graphics. Compatible with both C and C++. Public domain and easy to modify; Ben Visness (2016). |
| ⌛ ccvector.c | A vector and matrix math library; Job Talle (2015). |
| ⌛ doops.c | Single C file event loop; Eduard Suica (2019). |
| ⌛ ranxoshi256.c | Portable, single-file, PRNG library implementing the xoshiro256** algorithm; BareRose (2018). |
| ⌛ uuid4.c | UUID v4 generation in C; Grégory Pakosz (2019). |
| ⌛ uuid_h.c | Single file, STB-style, "lib" to generate uuid:s; Fredrik Kihlander (2016). |
| ⌛ range-v3.cxx | Range library for C++14/17/20, basis for C++20's std::ranges; Eric Niebler (XXXX). |
🍳 Computer Graphics
| Package | Description |
|---|---|
| ⚙️ clay.c | High performance UI layout library in C; Nic Barker (2024). |
| ⚙️ nuklear.c | A single-header ANSI C immediate mode cross-platform GUI library; Micha Mettke (2015). |
| ⚙️ microui.c | A tiny immediate-mode UI library; rxi (2018). |
| ⚙️ tigr.c | TIGR - the TIny GRaphics library for Windows, macOS, Linux, iOS and Android. |
| ⚙️ rgfw.c | A cross platform lightweight single-header simple-to-use window abstraction library for creating graphical programs or libraries; Riley Mabb (2023). |
| ⚙️ glfw3.c | A multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop; Marcus Geelnard (2002). |
| ⚙️ glad.c | Vulkan/GL/GLES/EGL/GLX/WGL Loader based on the official specs, using glad by David Herberth (2013). |
| ⚙️ vulkan.c | Vulkan header files and API registry; The Khronos Group (2018). |
| ⚙️ egl.c | EGL API and Extension Registry; The Khronos Group (2016). |
| ⚙️ voxelizer.c | Header only mesh voxelizer in c99; Karim Naaji (2016). |
| ⌛ sdl3.c | Simple DirectMedia Layer; Sam Lantinga (1997). |
| ⌛ openvr.c | OpenVR SDK; Valve Software (XXXX). |
| ⌛ openmodal.c | Dependency free, cross-platform, single header lib to open native file modals; bzt (2023). |
| ⌛ tinyfiledialogs.c | Modal dia logs inc. file open/save (Win/Mac/Linux); Guillaume Vareille (2014). |
| ⌛ lightmapper.c | A C/C++ single-file library for drop-in lightmap baking. Just use your existing OpenGL renderer to bounce light; ands (2016). |
| ⌛ sdl3.c | Simple DirectMedia Layer; Sam Lantinga (1997). |
| ⌛ glew.c | The OpenGL Extension Wrangler Library; Milan Ikits and Marcelo Magallon (2002). |
| ⌛ rfont.c | Simple-to-use single header modular font rendering library written in C; Riley Mabb (2023). |
🍳 Terminal utilities
| Package | Description |
|---|---|
| ⚙️ indicators.cxx | Activity Indicators for Modern C++; Pranav (2019). |
| ⚙️ rang.cxx | A Minimal, Header only Modern c++ library for terminal goodies; Abhinav Gauniyal (2016). |
| ⚙️ termcolor.cxx | Termcolor is a header-only C++ library for printing colored messages to the terminal. Written just for fun with a help of the Force; Ihor Kalnytskyi (2013). |
| ⚙️ linenoise.c | A small self-contained alternative to readline and libedit; Salvatore Sanfilippo (2010). |
| ⚙️ parg.c | Parser for argv that works similarly to getopt; Jørgen Ibsen (2015). |
| ⚙️ parg.cxx | A header only c++ library for parsing command line arguments and generating usage/help output; Brett Robinson (2018). |
| ⚙️ cmdline.cxx | A Command Line Parser; Hideyuki Tanaka (2009). |
🍳 Video
| Package | Description |
|---|---|
| ⚙️ pl_mpeg.c | Single file C library for decoding MPEG1 Video and MP2 Audio; Dominic Szablewski (2019). |
| ⌛ jo_mpeg.c | Simple, Minimalistic, No Allocations MPEG writer - without audio; Jon Olick and Wladislav Artsimovich (2016). |
🍳 Audio
| Package | Description |
|---|---|
| ⚙️ miniaudio.c | Audio playback and capture library written in C, in a single source file; David Reid (2016). |
| ⚙️ minimp3.c | Minimalistic MP3 decoder single header library; Lion (2018). |
| ⌛ dr_libs.c | Audio decoding libraries for C/C++, each in a single source file; David Reid (2015). |
| ⌛ tflac.c | A single file, freestanding FLAC encoding library in C89; John Regan (2024). |
| ⌛ pocketmod.c | Small ANSI C library for turning ProTracker MOD files into playable PCM audio; rombankzero (2018). |
| ⌛ atomix.c | Portable, single-file, wait-free atomic sound mixing library utilizing SSE-accelerated mixing; BareRose (2018). |
🍳 Networking
| Package | Description |
|---|---|
| ⚙️ httplib.cxx | A C++ header-only HTTP/HTTPS server and client library; yhirose (2012). |
| ⌛ crow.cxx | A Fast and Easy to use microframework for the web; Jaeseung Ha (2014). |
| ⌛ mongoose.c | Embedded web server, with TCP/IP network stack, MQTT and Websocket; Cesanta Software (2010). |
| ⌛ webby.c | A tiny webserver for game development; Andreas Fredriksson (2012). |
| ⌛ concord.c | A Discord API wrapper library made in C; Cogmasters (2020). |
🍳 Compression
| Package | Description |
|---|---|
| ⚙️ lz4.c | Extremely Fast Compression algorithm; lz4 (2011). |
| ⚙️ zlib.c | A massively spiffy yet delicately unobtrusive compression library; Mark Adler (2011). |
| ⚙️ dmc_unrar.c | A dependency-free, single-file FLOSS unrar library; Sven Hesse (2017). |
| ⌛ microtar.c | A lightweight tar library written in ANSI C; rxi (2016). |
| ⌛ miniz.c | miniz: Single C source file zlib-replacement library, originally from code.google.com/p/miniz; Rich Geldreich (2011). |
🍳 Cryptography
| Package | Description |
|---|---|
| ⌛ monocypher.c | An easy to use, easy to deploy crypto library; Loup Vaillant (2016). |
🍳 Serialization
| Package | Description |
|---|---|
| ⚙️ parson.c | Lightweight JSON library written in C; Krzysztof Gabis (2012). |
| ⚙️ mini.cxx | INI file reader and writer; Danijel Durakovic (2018). |
| ⚙️ lurlparser.cxx | Lightweight URL & URI parser (RFC 1738, RFC 3986); Sergey Kosarevsky (2015). |
| ⌛ inih.c | Simple .INI file parser in C, good for embedded systems; Ben Hoyt (2009). |
| ⌛ yxml.c | Yxml is a small (6 KiB) non-validating yet mostly conforming XML parser written in C; Yorhel (2013). |
| ⌛ tiny-json.c | The tiny-json is a versatile and easy to use json parser in C suitable for embedded systems. It is fast, robust and portable; Rafa Garcia (XXXX). |
| ⌛ model3d.c | 3D model format specification and single header SDK. Supports skeletal animations, voxels and has the best data density; bzt (2019). |
| ⌛ tinyobjloader.c | Header only tiny wavefront .obj loader in pure C99; Syoyo Fujita (2016). |
| ⌛ fast_obj.c | Fast C OBJ parser; Richard Knight (2018). |
| ⌛ cgltf.c | 💠 Single-file glTF 2.0 loader and writer written in C99; Johannes Kuhlmann (2018). |
| ⌛ qr-code-generator.c | High-quality QR Code generator library in Java, TypeScript/JavaScript, Python, Rust, C++, C; Nayuki (2016). |
| ⌛ cmp.c | An implementation of the MessagePack serialization format in C / msgpack.org; Charlie Gunyon (2014). |
| ⌛ libcmdf.c | Single-header library for writing CLI applications in C/C++; Ronen Kreimer (2017). |
| ⌛ kgflags.c | kgflags is an easy to use command-line flag parsing library; Krzysztof Gabis (2020). |
🍳 Text Processing
| Package | Description |
|---|---|
| ⚙️ peglib.cxx | A single file C++ header-only PEG (Parsing Expression Grammars) library; yhirose (2015). |
| ⚙️ remimu.c | Single-file header-only regex engine, C99/C++11; Alexander Nadeau (2024). |
| ⚙️ slre.c | Super Light Regular Expressions; Aquefir (2013). |
| ⚙️ unformat.cxx | Fastest type-safe parsing library in the world for C++14 or C++17 (up to 300x faster than std::regex); Adam Yaxley (2017). |
| ⚙️ ggformat.cxx | A string formatting library for C++; Michael Savage (2017). |
| ⚙️ utf8.c | 📚 Single header utf8 string functions for C and C++; Neil Henning (2015). |
| ⚙️ utf8proc.c | A clean C library for processing UTF-8 Unicode data; Steven G. Johnson (2014). |
| ⚙️ wcwidth9.c | Platform independent, header only, wcwidth with full unicode 9 support; Joshua Rubin (2016). |
| ⌛ str.c | str: yet another string library for C language; Maxim (2020). |
| ⌛ csplit.c | A single header C library to simplify splitting and processing strings; Jakub Wlodek (2019). |
| ⌛ stmr.c | Porter Stemmer algorithm in C; Titus (2014). |
| ⌛ levenshtein.c | Levenshtein algorithm in C; Titus (2015). |
| ⌛ fmt.cxx | A modern formatting library; Victor Zverovich (XXXX) |
🍳 Emulation/Scripting
| Package | Description |
|---|---|
| ⚙️ pocketpy.c | Portable Python 3.x Interpreter in Modern C for Game Scripting; pocketpy (2022). |
| ⚙️ minilua.c | Single-file port of Lua, a powerful scripting language; Eduardo Bart (2020). |
| ⚙️ my_basic.c | A lightweight BASIC interpreter written in standard C in dual files. Aims to be embeddable, extendable and portable; Tony Wang (2014). |
| ⚙️ tinyexpr.c | Tiny recursive descent expression parser, compiler, and evaluation engine for math expressions; Lewis Van Winkle (2016). |
| ⚙️ chasm.c | Chasm Runtime Assembler; Aqil Contractor (2025). |
| ⌛ webview.c | Tiny cross-platform webview library for C/C++. Uses WebKit (GTK/Cocoa) and Edge WebView2 (Windows); Serge Zaitsev (2017). |
| ⌛ fex.cxx | A fast usermode x86 and x86-64 emulator for Arm64 Linux; Ryan Houdek (XXXX). |
| ⌛ vixl.c | AArch32 and AArch64 Runtime Code Generation Library; Linaro (XXXX). |
| ⌛ v86.c | x86 PC emulator and x86-to-wasm JIT, running in the browser; Fabian (XXXX). |
| ⌛ agnes.c | NES emulation library with an easy to use API; Krzysztof Gabis (2019). |
| ⌛ apelang.c | Ape Programming Language; Krzysztof Gabis (2020). |
| ⌛ softfloat3.c | SoftFloat release 3; John Hauser (XXXX). |
🍳 Testing/Debugging
| Package | Description |
|---|---|
| ⚙️ debugbreak.c | Break into the debugger programmatically; Scott Tsai (2011). |
| ⚙️ b_stacktrace.c | A minimalistic single-header multi-platform C89 lib for stack tracing; Borislav Stanimirov (2020). |
| ⚙️ clove-unit.c | Single-Header Unit Testing framework for C (interoperable with C++) with test autodiscovery feature; Federico De Felici (2021). |
| ⚙️ rexo.c | Neat single-file cross-platform unit testing framework for C/C++; Christopher Crouzet (2018). |
| ⌛ remotery.c | Single C file, Realtime CPU/GPU Profiler with Remote Web Viewer; Celtoys (2014). |
| ⌛ tracy.cxx | Frame profiler; Bartosz Taudul (XXXX). |
| ⌛ errnoname.c | errnoname is a C library that lets us get the symbolic name for each errno integer value; mentalisttraceur (2019). |
| ⌛ fctx.c | C unit testing in a header (works for C++ too!); Ian Blumel (2008). |
| ⌛ greatest.c | A C testing library in 1 file. No dependencies, no dynamic allocation. ISC licensed; Scott Vokes (2012). |
| ⌛ utest.c | 🧪 single header unit testing framework for C and C++; Neil Henning (2015). |
| ⌛ minctest.c | tiny unit testing framework for ANSI C; Lewis Van Winkle (2015). |
| ⌛ labrat.c | Simple, single-file test harness for C/C++; Alex Thayer (2016). |
| ⌛ munit.c | µnit is a small testing framework for C; Evan Nemerson (2016). |
🍳 Others
| Package | Description |
|---|---|
| ⚙️ units.cxx | A compile-time, header-only, dimensional analysis and unit conversion library built on C++14 with no dependencies; Nic Holthaus (2016). |
| ⚙️ magic_enum.cxx | Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code; Daniil Goncharov (2019). |
| ⚙️ nameof.cxx | Nameof operator for modern C++, simply obtain the name of a variable, type, function, macro, and enum; Daniil Goncharov (2016). |
| ⚙️ scope_guard.cxx | Scope Guard & Defer C++; Daniil Goncharov (2018). |
| ⚙️ semver.cxx | Semantic Versioning for modern C++; Daniil Goncharov (2018). |
| ⚙️ hedley.c | A C/C++ header to help move #ifdefs out of your code; Evan Nemerson (2016). |
| ⚙️ catch2.cxx | A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch); Martin Hořeňovský (2010). |
| ⚙️ macroarg.c | Manage arguments of macros in C. |
| ⌛ endianness.c | Simple public domain header to get endianess at compile time on a variety of platforms; rofl0r (2017). |
| ⌛ asap.cxx | A C++ header-only library for creating, displaying, iterating and manipulating dates; Leonardo Guilherme de Freitas (2017). |
| ⌛ canvas_ity.cxx | A tiny, single-header canvas-like 2D rasterizer for C++; Andrew Kensler (2022). |
| ⌛ cds_job.cxx | C++11 lock-free job queue; Cort Stratton (2016). |
| ⌛ cimg.cxx | The CImg Library is a small and open-source C++ toolkit for image processing; GREYC (2018). |
| ⌛ cista.cxx | Cista is a simple, high-performance, zero-copy C++ serialization & reflection library; Felix Gündling (2018). |
| ⌛ cpp-mmaplib.cxx | A single file C++11 header-only memory mapped file library; yhirose (2016). |
| ⌛ cpp-unicodelib.cxx | A C++17 header-only Unicode library. (Unicode 16.0.0); yhirose (2016). |
| ⌛ debug-draw.cxx | Immediate-mode, renderer agnostic, lightweight debug drawing API; Guilherme Lampert (2015). |
| ⌛ doctest.cxx | The fastest feature-rich C++11/14/17/20/23 single-header testing framework; Viktor Kirilov (2016). |
| ⌛ flags.cxx | ⛳ Simple, extensible, header-only C++17 argument parser released into the public domain; sailormoon (2016). |
| ⌛ hippomocks.cxx | Single-header mocking framework; Peter Bindels (2008). |
| ⌛ imgui.cxx | Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies; Omar (2014). |
| ⌛ immediate2d.cxx | A C++ drawing framework for Windows that makes simple graphics programming as fun and easy as the days when computers booted directly to a BASIC prompt; Nicholas Piegdon (2017). |
| ⌛ inja.cxx | A Template Engine for Modern C++; Berscheid (2017). |
| ⌛ jargsparser.cxx | A head-only arguments parser(argsparser) c++11 lib; Zhengqiao Wang (2022). |
| ⌛ json.cxx | JSON for Modern C++; Niels Lohmann (2013). |
| ⌛ linalg.cxx | linalg.h is a single header, public domain, short vector math library for C++; Sterling Orsten (2016). |
| ⌛ lurlparser.cxx | Lightweight URL & URI parser (RFC 1738, RFC 3986); Sergey Kosarevsky (2015). |
| ⌛ micropather.cxx | MicroPather is a path finder and A* solver (astar or a-star) written in platform independent C++ that can be easily integrated into existing code. MicroPather focuses on being a path finding engine for video games but is a generic A* solver; Lee Thomason (2012). |
| ⌛ microprofile.cxx | microprofile is an embeddable profiler; Jonas Meyer (2013). |
| ⌛ mini-yaml.cxx | Single header YAML 1.0 C++11 serializer/deserializer; Jimmie Bergmann (2018). |
| ⌛ obfuscate.cxx | Guaranteed compile-time string literal obfuscation header-only library for C++14; Adam Yaxley (2017). |
| ⌛ programoptions.cxx | Single-header program options parsing library for C++11; Fytch (2017). |
| ⌛ pugixml.cxx | Light-weight, simple and fast XML parser for C++ with XPath support; Arseny Kapoulkine (2006). |
| ⌛ random.cxx | Random for modern C++ with convenient API; Illia (2017). |
| ⌛ simple-svg.cxx | Easy to use SVG library for C++ (fork of legacy Google code project archive); Adi Shavit (2015). |
| ⌛ str_view.cxx | Null-termination-aware string-view class for C++; Adam Sawicki (2018). |
| ⌛ str.cxx | Lightweight C++ string type with a configurable local buffer; Omar (2015). |
| ⌛ swarmz.cxx | A free, header-only C++ swarming (flocking) library for real-time applications; Michael (2016). |
| ⌛ tinyformat.cxx | Minimal, type safe printf replacement library for C++; Claire Foster (2011). |
| ⌛ tinyobjloader.cxx | Tiny but powerful single file wavefront obj loader; tinyobjloader (2012). |
| ⌛ tinyply.cxx | 🌍 C++11 ply 3d mesh format importer & exporter; Dimitri Diakopoulos (2015). |
| ⌛ tinythread.cxx | Cross-platform implementation of the C++11 Threads API; Marcus Geelnard (2010). |
| ⌛ tinyxml2.cxx | TinyXML2 is a simple, small, efficient, C++ XML parser that can be easily integrated into other programs; Lee Thomason (2011). |
| ⌛ tomlplusplus.cxx | Header-only TOML config file parser and serializer for C++17; Mark Gillard (2020). |
| ⌛ trompeloeil.cxx | Header only C++14 mocking framework; Björn Fahller (2014). |
| ⌛ utl.cxx | Collection of self-contained header-only libraries for C++17; DmitriBogdanov (2023). |
| ⌛ visit_struct.cxx | A miniature library for struct-field reflection in C++; Chris Beck (2016). |
| ⌛ vulkanmemoryallocator.cxx | Easy to integrate Vulkan memory allocation library; GPUOpen Libraries & SDKs (2017). |
| ⌛ xatlas.cxx | Mesh parameterization / UV unwrapping library; Jonathan Young (2016). |

