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). |

