Skip to content

kokizzu/single_file_libs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 

Repository files navigation

C/C++ open-source libraries with minimal dependencies

Generally, the following is a list of small, easy-to-integrate, portable libraries which are usable from C and/or C++, and should be able to be compiled on both 32-bit and 64-bit platforms. There is preference for libraries that are C, public domain and single-file. However, we have not personally verified that any specific library is as advertised, or is quality software.

New libraries and corrections

We accept submissions for new libraries and corrections if information for a library below is wrong. Consider either opening a Pull Request, a new Issue or drop a message in our discord channel: https://discord.gg/2fZVEym The server is meant to be a pleasant space to chat about C, C++, Libs authoring and Game development specifically.

Rules

  • Libraries must be usable from C or C++, ideally both.
  • Libraries must include the licensing terms in the header and source files.
  • Libraries should be usable from more than one platform (ideally, all major desktops and/or all major mobile).
  • Libraries should compile and work on both 32-bit and 64-bit platforms.
  • Libraries should use at most two files (one header, one source): more than two files are mostly forbidden.

Exceptions will be allowed for good reasons.

Other lists

Also you might be interested in other related, but different lists:

Main listing

Single-header C files with clause-less licenses are highlighted.

tag library
2d Blendish (1 C, MIT)
Blender-style widget rendering using NanoVG
2d C-Turtle (1 C++, MIT)
Port of Python's Turtle to C++
2d Cgl (2 C, MIT)
C Game Library
2d Cimg (1 C++, CeCILL)
Image processing toolkit (60K LoC)
2d Colourblind (1 C, ISC)
Simulating colourblindness
2d Daisy (1 C++, MIT)
2D Graphics and text
2d Immediate2D (2 C++, PD)
Zero-configuration, immediate-mode 2D graphics for Windows
2d M_image.h (1 C, ZLIB)
Image processing routines
2d RFont (1 C, ZLIB)
Simple-to-use lightweight single header modular font rendering library
2d RGL (1 C, ZLIB)
Simple ultra-lightweight OpenGL version abstraction based on RLGL (pipeline system)
2d Scalable-font2 (1 C, MIT)
Scalable Font renderer + specification
2d Si_normalmap (1 C, PD)
Image to Normal Map generator
2d Tigr (2 C, PD)
Quick-n-dirty window text/graphics for Windows and macOS
2d Wfc (1 C, MIT)
Generate image locally similar to the input image using WFC algorithm
3d Debug-draw (1 C++, PD)
API-agnostic immediate-mode debug rendering
3d Lightmapper (1 C, PD)
Use your OpenGL renderer to offline bake lightmaps
3d Mikktspace (2 C, ZLIB)
Compute tangent space for normal mapping
3d Model3d (1 C, MIT)
3D model format specification
3d Seamoptimizer (1 C, PD)
Modify lightmap data to hide seams
3d Simple OpenGL Loader (1 C, MIT)
Extensible, cross-platform OpenGL loader
3d Small3dlib (1 C, CC0)
Fast and portable software renderer
3d Stb_voxel_render (1 C, PD)
Minecraft-esque voxel rendering "engine" with many more features
3d Swarmz (1 C++, PD)
Swarming/flocking algorithm
3d Tinygizmo (2 C++, PD)
Gizmo objects for interactively editing 3d transformations
3d Vertex Cache Optimizer (1 C, PD)
Vertex cache optimization of meshes
3d Vulkan Memory Allocator (1 C, MIT)
Memory allocator for Vulkan
ai Genann (2 C, ZLIB)
Simple neural networks (ANN)
ai KANN (2 C, MIT)
Automatic differentiation (2 files)
app RGFW (1 C, ZLIB)
A multi-platform single-header user-friendly GUI framework as an alternative to GLFW
argv Argh! (1 C++, BSD)
Command-line argument parsing
argv Clara (1 C++, BOOST)
Composable, command line parser for C++ 11 and beyond
argv CLI11 (1 C++, BSD)
Feature-rich CLI parsing in modern C++11
argv Cmdline (1 C++, BSD)
Command-line argument parsing
argv Flags (1 C++, PD)
Command-line argument parsing
argv Kgflags (1 C, MIT)
Command-line argument parsing
argv Linkom (1 C, MIT)
Command-line argument parsing w/ DOS-style options
argv Optionparser (1 C++, MIT)
Command-line argument parsing
argv Parg (2 C, PD)
Command-line argument parsing
argv ProgramOptions.hxx (1 C++, MIT)
Command-line argument parsing
audio Atomix (1 C, PD)
Wait-free atomic sound mixer
audio Aw_ima.h (1 C, MIT)
IMA-ADPCM audio decoder
audio Btac1c (1 C, MIT)
MS-IMA_ADPCM variant
audio Chibi-xmplay (2 C, BSD3)
XM module playback library
audio Geneva (1 C, MIT)
Library generating 8-bit waveforms of various kinds
audio Miniaudio (1 C, PD)
Audio playback and capture library
audio Minimp3 (1 C, CC0)
Minimalistic MP3 decoder with sse/neon support
audio MojoAL (1 C, ZLIB)
Full OpenAL 1.1 implementation
audio Nanoalsa (1 C, MIT)
Tiny PCM playback under Linux
audio Pocketmod (1 C, MIT)
ProTracker MOD file renderer
audio Stb_hexwave (1 C, PD)
Audio waveform synthesizer
audio Stb_vorbis (1 C, PD)
Decode ogg vorbis files from file/memory to float/16-bit signed output
audio TinySoundFont (1 C, MIT)
SoundFont2 loader & synthesizer
bench Picobench (1 C++, MIT)
Microbenchmarking
bench Ubench.h (1 C, PD)
Microbenchmarking
c Errnoname (2 C, BSD0)
Extended errno messages
c Minicoro (1 C, PD-0MIT)
Stackful cross-platform coroutine library
c Stb_sprintf (1 C, PD)
Fast sprintf, snprintf for C/C++
cpp Filesystem (1 C++, MIT)
Implementation of std::filesystem
cpp Outcome (1 C++, APACHE2-BOOST)
Outcome and result C++ containers
crypt Ggentropy (2 C++, ISC)
Cross platform entropy library
crypt Monocypher (2 C, PD)
High-quality small cryptography library
crypt Random3 (1 C, PD)
Crypt-random generator
crypt TweetNaCl (2 C, PD)
High-quality tiny cryptography library
csv CSVstream (1 C++, MIT)
CSV parser
csv Fast C++ CSV Parser (1 C++, BSD)
CSV parser
csv Rapidcsv (1 C++, BSD)
CSV parser
csv Vince's CSV Parser (1 C++, MIT)
CSV parser and serializer
date Date (1 C++, MIT)
Date and time libraries
debug B_stacktrace (1 C, MIT)
Stack tracing
debug Dbgtools (2 C, ZLIB)
Cross-platform debug util libraries
debug Debug-assert (1 C++, ZLIB)
Modular assertion macro
debug Debugbreak (1 C, BSD)
Programmatic debug break
debug Loguru (1 C++, PD)
Flexible logging
debug Pempek_assert.cpp (2 C++, WTFPL2)
Flexible assertions
dev EasyTab (1 C, PD)
Multi-platform tablet input
dev Libue (1 C, MIT)
Helper library for Linux device hot-plug event
ds AArray (1 C, PD)
Arrays/strings: generic, safe
ds Avl (2 C, PD)
AVL tree
ds Cds_algo (1 C, PD)
Collection of data structures (queue, stack, graph, heap...)
ds DG_dynarr.h (1 C, PD)
Typesafe dynamic arrays (like std::vector) for plain C
ds Dynarr (1 C, PD)
Dynamic array container
ds DynaVar (1 C++, GPL3)
Object which can store any type of primitive data type
ds Fifo_declare.h (1 C, LGPL2)
Thread/core safe FIFO
ds Itlib (1 C++, MIT)
Several C++11 standard-contaner-like libraries and helpers
ds Jhr_skip_list (1 C++, PD)
Skip Lists
ds Jrsl (1 C, PD)
Skip Lists
ds Klib (2 C, MIT)
Many 2-file libs: hash, sort, b-tree, etc
ds Libintrusive (2 C, PD)
Intrusive data structures
ds Libpqueue (2 C, BSD)
Priority queue (heap)
ds LinkedList (2 C, MIT)
Linked list C++
ds Mempool (1 C++, MIT)
Efficient minimal memory pool implementation for C++
ds PackedArray (2 C, WTFPL2)
Memory-efficient array of elements with non-pow2 bitcount
ds Selist (2 C, ISC)
Space-efficient linked-list
ds Simclist (2 C, BSD)
Linked-list
ds Stb_ds (1 C, PD)
Typesafe dynamic array and hash tables for C, will compile in C++
ds Uthash (2 C, BSD)
Several 1-header, 1-license-file libs: generic hash, list, etc
engine Kit (1 C, PD)
Tiny library for making small games with big pixels
engine OlcPixelGameEngine (1 C++, BSD3)
Game engine
engine Punity (1 C, MIT)
A tiny game engine in C
file Dirent (1 C, MIT)
Dirent for Windows: retrieve file & dir info
file Miniphysfs (1 C, ZLIB)
Single-file port of PhysFS, a fs/zip abstraction
file Tfile (1 C++, MIT)
FILE* wrapper does read-write-append-seek-close (Win/Mac/Unix)
file TinyDir (1 C, BSD)
Cross-platform directory reading (Win/POSIX/MinGW)
file Whereami (2 C, WTFPL2)
Get path/filename of executable or module
font Blit-fonts (1 C, ISC)
Bitmap font blitters
font Ssfn.h (1 C, MIT)
Scalable/bitmap/pixmap font renderer
font Stb_easy_font (1 C, PD)
Quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc
font Stb_truetype (1 C, PD)
Parse, decode, and rasterize characters from truetype fonts
game Raycastlib.h (1 C, CC0)
Advanced raycasting rendering library, pure C99 with no dependencies, only 32bit int math
game Stb_connected_components (1 C, PD)
Incrementally compute reachability on grids
game Stb_herringbone_wang_tile (1 C, PD)
Herringbone Wang tile map generator
game Stb_tilemap_editor (1 C, PD)
Embeddable tilemap editor
hash Hash.c (2 C, PD)
SHA1/SHA3/MD5 hashes
hash Lonesha256 (1 C, PD)
SHA256 implementation
hash PicoSHA2 (1 C++, MIT)
SHA256 implementation
hash XxHash (2 C, BSD)
Fast hash function
image Bitmap (1 C++, MIT)
Bitmap decoder and utilities
image Cro_mipmap.h (1 C, PD)
Average, min, max mipmap generators
image Framepacker (1 C++, MIT)
Texture bin packing algorithm
image Jo_sift (1 C, PD)
Image feature detection and matching
image Stb_image (1 C, PD)
Image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
image Stb_image_resize (1 C, PD)
Resize images larger/smaller with good quality
image Stb_image_write (1 C, PD)
Image writing to disk: PNG, TGA, BMP
image Stb_perlin (1 C, PD)
Perlin's revised simplex noise w/ different seeds
image Stb_rect_pack (1 C, PD)
Simple 2D rectangle packer with decent quality
image Tiffloader (2 C, PD)
TIFF image loader
image EXR Miniexr (2 C++, PD)
OpenEXR writer, needs header file
image EXR Tinyexr (1 C, BSD)
EXR image read/write, uses miniz internally
image GIF Gif.h (1 C++, PD)
Animated GIF writer (can only include once)
image GIF Gif_load (1 C, PD)
(animated) GIF reader
image GIF Jo_gif.cpp (1 C++, PD)
Animated GIF writer (CPP file can also be used as H file)
image JPG Jpeg-compressor (2 C++, PD)
2-file JPEG compress, 2-file JPEG decompress
image JPG NanoJPEG (1 C, MIT)
JPEG decoder
image JPG Tiny_jpeg.h (1 C, PD)
JPEG encoder
image JPG EXIF Easyexif (2 C++, BSD2)
EXIF metadata extractor for JPEG images
image JPG EXIF TinyEXIF (2 C++, BSD)
Parse EXIF data from JPEG (XMP w/ TinyXML2 lib)
image PDF PDFgen (2 C, PD)
PDF writer
image PNG Lodepng (2 C, ZLIB)
PNG encoder/decoder
image PNG Picopng.cpp (2 C++, ZLIB)
Tiny PNG loader
image PNG TinyPngOutput (2 C, LGPLv3)
PNG writer
image PNM PNM (1 C++, APACHE2)
PBM, PGM and PPM reader and writer
image SVG NanoSVG (1 C, ZLIB)
1-file SVG parser; 1-file SVG rasterizer
image WEBP Jebp (1 C, 0MIT)
Single header WebP decoder
ini Inih (2 C, BSD)
.ini file parser
json Ajson (1 C++, BOOST)
JSON serialize & deserialize w/ STL support
json CJSON (1 C, MIT)
JSON parser
json CJSON (1 C, MIT)
JSON parser
json Jsmn (1 C, MIT)
Minimalistic JSON parser
json Json-build (1 C, MIT)
JSON serializer
json Json.h (1 C, PD)
JSON parser
json Json.hpp (1 C++, MIT)
JSON parse, serialize, deserialize
json Jsonc (1 C, MIT)
Extremely fast and extremely small (~60 SLoC) JSON parser
json Jzon.h (2 C++, MIT)
JSON parser
json Parson (2 C, MIT)
JSON parser and serializer
json PicoJSON (1 C++, BSD)
JSON parse/serializer
json Sjson (1 C, BSD2)
JSON encode/decoder
logic FFSM2 (1 C++, MIT)
Flat FSM
logic HFSM2 (1 C++, MIT)
Hierarchical FSM
math Amoeba (1 C, MIT)
Constraint solver (Cassowary) w/Lua binding
math Cds_spline (1 C, PD)
Spline utils
math Ceval-single-header (1 C, MIT)
A single-header library for parsing and evaluation of arithmetic expressions
math Clipper (2 C++, BOOST)
Line & polygon clipping & offsetting
math Delaunay (2 C++, BSD3)
2D and 3D Delaunay triangulation
math Df (1 C, PD)
Find voronoi region in linear time of size of lattice
math Dvector (1 C, PD)
2D/3D vector/quaternion/matrix math library
math ExprTk (1 C++, MIT)
Runtime mathematical expression parser and evaluation engine.
math Fft (1 C++, PD)
Fast Fourier Transform
math HMM Toolkit (1 C, GPL2)
Discrete and continuous Hidden Markov Models (DHMM, CHMM)
math Jc_voronoi (1 C, MIT)
Find voronoi regions on float/double data
math Linmath.h (1 C, WTFPL2)
Vector library
math M_math.h (1 C, ZLIB)
Math with C/OpenCL portability
math Nanoflann (1 C++, BSD)
Build KD trees for point clouds
math Nv_voronoi.h (1 C, PD)
Find voronoi regions on lattice w/ integer inputs
math Omm (1 C++, MIT)
Template open multi-methods
math OpenNL (2 C++, BSD3)
Linear and eigen solvers
math Par_msquares (1 C, MIT)
Convert (binarized) image to triangles
math Par_shapes (1 C, MIT)
Generate various 3d geometric shapes
math Par_streamlines (1 C, MIT)
Tessellate wide lines and curves with shading attributes
math PoissonGenerator.h (1 C++, MIT)
Poisson disk points generator (disk or rect)
math PolyPartition (2 C++, MIT)
Polygon triangulation, partitioning
math Precision (1 C++, PD)
Arbitrary-precision integer and rational arithmetic
math Prns.h (1 C, PD)
Seekable pseudo-random number sequences
math Rfft.h (1 C, PD)
Fast Fourier Tranform for arbitrary array sizes
math Sdf.h (1 C, MIT)
Compute signed-distance field from antialiased image
math ShaderFastLibs (1 C++, MIT)
(also HLSL) Approximate transcendental functions optimized for shaders (esp. GCN)
math Simple_linear_regression (1 C, MIT)
Simple linear regression
math Simrank.hpp (2 C++, MIT)
SimRank graph similarity algorithm
math Sobol.h (1 C, PD)
Sobol & stratified sampling sequences
math Statistics-Tool-Box (1 C, PD)
Statistical functions
math Stb_divide (1 C, PD)
More useful 32-bit modulus
math SummedAreaTable (1 C++, MIT)
Summed-Area Table generation and sum/avg queries
math TinyExpr (2 C, ZLIB)
Evaluation of math expressions from strings
math Tomas Akenine-Moller snippets (2 C, PD)
Various 3D intersection calculations, not lib-ified
math Vmath (1 C, PD)
Vector/matrix library
math Voxelizer (1 C, MIT)
Convert triangle mesh to voxel triangle mesh
math Xatlas (2 C++, MIT)
Mesh parameterization
mem Buddy_alloc (1 C, BSD0)
Buddy memory allocator
mem Stb_leakcheck (1 C, PD)
Quick-and-dirty malloc/free leak-checking
mem Wb_alloc (1 C, PD)
Custom allocators in a single-header
mesh Cgltf (1 C, MIT)
GlTF 2.0 file loader
mesh Fast_obj.h (1 C, MIT)
Wavefront OBJ file loader
mesh M3d.h (1 C, MIT)
Model 3D importer/exporter (with Blender, Goxel, WebGL JS and assimp integration)
mesh Objzero (2 C, MIT)
Wavefront OBJ file loader
mesh Qll_q3.h (1 C++, WTFPL2)
Quake3 BSP loader
mesh Tinyobjloader-c (1 C, MIT)
Wavefront OBJ file loader
mesh Tinyobjloader (1 C++, MIT)
Wavefront OBJ file loader
mesh Tinyply (2 C++, PD)
PLY mesh file loader
mesh Tk_objfile (1 C, MIT)
OBJ file loader
misc ASAP (1 C++, MIT)
Library for parsing, printing, iterating and operating on dates.
misc CLM_LIBS (1 C, PD)
Diverse utilities
misc Color-Toolkit (1 C, GPL2)
Color conversion utils (RGB, XYZ, Lab, CIE76, CIE94 and CIEDE200)
misc Cpp-generators (1 C++, BSD)
Generators in C++
misc Ebnn.h (1 C, MIT)
BNN (Binarized Neural Networks)
misc H.h (1 C, GPL3)
Diverse utilities
misc Hedley (1 C, PD)
Compiler portability, optimization, static analysis, etc.
misc MakeID.h (1 C++, PD)
Allocate/deallocate small integer IDs efficiently
misc Mmu (2 C, MIT)
Memory management and data structure toolset
misc OpenGA (1 C++, MPL2)
A C++ Generic Algorithm solver library
misc PlusCallback (1 C++, ZLIB)
Function/method callbacks
misc Process.h (1 C, PD)
Process control API
misc QR-Code-generator (2 C, MIT)
QR Code generator
misc Qsort (1 C, MIT)
Qsort algorithm as a C macro
misc Scogem.c (2 C, PD)
URL parser
misc Sili-toolchain (1 C, PD)
C toolchain for modern C programming, strings, arrays, files, threading, ect
misc Smallxrm.c (2 C, PD)
Implementation of X resource manager
misc Stb_include (1 C, PD)
Implement recursive #include support, particularly for GLSL
misc Stmr (2 C, MIT)
Extract English word stems
misc X.h (1 C, MULAN2)
Cross-platform C/C++ utilities
nav M_path_finding.h (1 C, ZLIB)
Floodfill-based path finding
nav Micropather (2 C++, ZLIB)
Pathfinding with A*
net Civetweb (2 C, MIT)
HTTP server, fork of Mongoose
net Cpp-httplib (1 C, MIT)
Cross-platform HTTP server/client
net Enet (1 C, MIT)
Reliable UDP networking library
net EWS (1 C, BSD)
HTTP server
net Happyhttp (2 C++, ZLIB)
HTTP client requests
net Libcluon (1 C++, MPL2)
Cross-platform socket wrapper and data marshalling with native implementations for Protobuf, LCM/ZCM, JSON, and MsgPack serialization/deserialization
net Librg (1 C, BSD3)
World/entity synchronization multiplayer library
net LUrlParser (2 C++, MIT)
Lightweight URL & URI parser RFC 1738, RFC 3986
net Mongoose (2 C, GPLv2)
HTTP server
net Netq (1 C, MIT)
Reliable datagram library
net Par_easycurl.h (1 C, MIT)
CURL wrapper
net Simpletls.c (2 C, PD)
Function to create a socket and connect to a remote server with TLS
net Swrap (1 C, PD)
TCP and UDP socket wrapper
net Tiniest-analytics (2 C++, MIT)
Cross-platform analytics for games (using Google Analytics <4)
net Tiny-MQTT-c (4 C, PD)
Small implementation of (some of) the MQTT protocol in C
net Tlse (2 C, PD-BSD2)
TLS v1.0, 1.2, 1.3 and DTLS 1.0, 1.2 implementations
net Webster (2 C++, APACHE2)
Standalone HTTP server/client
net Yocto (2 C, PD)
Non-production-use HTTP server
net Zed_net (1 C, PD)
Cross-platform socket wrapper
net Znet (1 C, MIT)
Cross-platform networking w/ Lua binding
pack Dmc_unrar (1 C, GPL2)
RAR file decompression
pack Fastlz (2 C, MIT)
Fast but larger LZ compression
pack Lz4 (2 C, BSD)
Fast but larger LZ compression
pack Microtar (2 C, MIT)
Lightweight tar library
pack Miniz.c (1 C, MIT)
Compression, decompression, ZIP file, PNG writing
pack Nibrans (1 C, PD)
Adaptive rANS library
pack Pithy (2 C, BSD)
Fast but larger LZ compression
pack Rle (1 C, MIT)
Run-length en/decoder
pack Stb_dxt (1 C, PD)
Real-time DXT compressor
parse Cmp (2 C, MIT)
MessagePack parser and serializer
parse Cpp-peglib (1 C, MIT)
PEG (Parsing Expression Grammars) library
parse Furi (1 C, MIT)
URL & URI parsing
parse Html-parse.c (2 C, GPL)
HTML parser (wget)
parse SLRE (1 C, GPL2)
Regular expression matcher
parse Stb_c_lexer (1 C, PD)
Simplify writing parsers for C-like languages
parse Tok (1 C, MIT)
Configurable tokenizer
parse Tomlplusplus (1 C++, MIT)
TOML parser and serializer
parse Udisasm (1 C, MIT)
Extremely small disassembler for ARMv8.2 AArch64 (~65k)
parse Unformat (1 C++, PD)
Parses formatted strings (reverse of std::format)
prng Random (1 C++, MIT)
Convenient API for random
prng Ranxoshi256 (1 C, PD)
Xoshiro256 algorithm
prng SimplexNoise (1 C++, BSD2)
Collection of noise generators
profile MicroProfile (4 C++, PD)
CPU (and GPU?) profiler, 1-3 header files, uses miniz internally
profile Prof (1 C, MIT)
Profiler for Linux
profile Remotery (2 C, APACHE2)
CPU/GPU profiler Win/Mac/Linux, using web browser for viewer
raster Canvas_ity (1 C++, ISC)
2D rasterizer
regex Remimu (1 C, CC0)
Regex engine
script Duktape (2 C, MIT)
Embeddable JavaScript engine
script LIL (2 C, ZLIB)
Interpreter for a Tcl-like scripting language
script Lualite (1 C++, MIT)
Generate Lua bindings in C++
script Minilua (1 C, MIT)
Single-file port of Lua scripting language
script MY-BASIC (2 C, MIT)
Interpreter for a BASIC dialect scripting language
script Picol (1 C, BSD)
Interpreter for a Tcl-like scripting language
script S7 (2 C, BSD)
Interpreter for a subset of Scheme (R5RS/R7RS)
script Xpl (1 C, WTFPL2)
X Programming Language
serial Archive (1 C++, PD)
Binary serialize & deserlize w/ STL support
serial Blob_tree (1 C++, MIT)
Binary tree serializer
serial Cista (1 C++, MIT)
Cross-platform high performance zero copy C++17 serialization/deserialization
serial Libcluon (1 C++, MPL2)
Cross-platform data serialization/deserialization with native implementations for Protobuf, LCM/ZCM, JSON, and MsgPack
serial Qserial (1 C++, BSD3)
Schema-driven serialization library
serial Serialization helper (1 C, WTFPL2)
Serialization helper
serial Visit_struct (2 C++, BOOST)
Struct-field reflection
string Csplit (1 C, MIT)
String splitting and processing single-header library
string Dfa (2 C, MIT)
Fast UTF-8 decoder (need a header file)
string Gb_string.h (1 C, PD)
Dynamic strings
string Ggformat (2 C++, ISC)
Printf replacement
string Inja.hpp (1 C++, MIT)
Template engine
string Levenshtein (2 C, MIT)
Compute edit distance between two strings
string Obfuscate (1 C++, PD)
Guaranteed compile-time string literal obfuscation library for C++14
string Str.h (1 C++, PD)
Simple C++ string type with an optional local buffer
string Str (2 C, BSD)
Yet another string library for C language
string Str_view.hpp (1 C++, MIT)
Null-termination-aware string-view class
string Tinyformat (1 C++, BOOST)
Typesafe printf
string Utf8 (1 C, PD)
UTF-8 string library
svg SimpleSVG (1 C++, BSD3)
Easy to use SVG library
sys Doops (1 C, PD)
Event loop library
sys Endianness.h (1 C, PD)
Endianness conversion and detection
sys JArgsParser (1 C++, MIT)
Arguments parser
sys Openmodal (1 C, MIT)
Native file modals
sys Rang (1 C++, PD)
Cross-platform colored console text
sys Xproc (2 C++, MIT)
Foreign Process Information
thread Bikeshed.h (1 C, MIT)
Cross-platform lock free fixed memory hierarchical work scheduler
thread Cds_job (1 C++, PD)
Lock-free job queue
thread Cds_sync (1 C, PD)
Collection of synchronization primitives
thread TinyCThread (2 C, ZLIB)
Cross-platform implementation of the C11 Threads API
thread TinyThread++ (2 C++, ZLIB)
Cross-platform implementation of the C++11 Threads API
ui Clay (1 C, ZLIB)
High performance 2D UI layout library
ui Dear imgui (9 C++, MIT)
An immediate-mode GUI formerly named "ImGui"; 3rd-party C wrapper
ui Libcmdf (1 C, PD)
A small library for writing CLI applications
ui Linenoise (2 C, BSD)
Terminal readline w/ history etc
ui Nuklear (1 C, PD)
Minimal GUI toolkit
ui Stb_textedit (1 C, PD)
Guts of a text editor for games etc implementing them from scratch
ui Tinyfiledialogs (2 C, ZLIB)
Modal dialogs inc. file open/save (Win/Mac/Linux)
ui Wcwidth9 (1 C, APACHE2)
Platform independent wcwidth with full unicode 9 support
ui Webview (1 C, MIT)
Cross-platform webview library
unit Catch2 (1 C++, BOOST)
Unit testing
unit Catch (1 C++, BOOST)
Unit testing
unit Clove-unit (1 C, MIT)
Unit testing
unit Doctest (1 C++, MIT)
Unit testing
unit Fctx (1 C, BSD)
Unit testing
unit Greatest (1 C, ISC)
Unit testing
unit Hippomocks (1 C++, LGPL)
Unit testing
unit Labrat (1 C, PD)
Unit testing
unit Minctest (1 C, ZLIB)
Unit testing
unit Munit (1 C, MIT)
Unit testing
unit Picotest (1 C, MIT)
Unit testing
unit Rexo (1 C, PD)
Framework for C89/C++ featuring automatic registration of tests and a polished API
unit SPUT (1 C, BSD)
Unit testing
unit Trompeloeil (1 C++, BOOST)
Unit testing
unit Utest.h (1 C, PD)
Unit testing
unit Utest (1 C, MIT)
Unit testing
unit Walter (1 C, PD)
Unit testing
uuid Uuid4 (2 C, WTFPL2-MIT)
UUID v4 generator
uuid Uuid_h (1 C, ZLIB)
UUID generator
vector Algebra3.h (1 C++, PD)
Vector utilities for 2, 3, and 4 element vectors, all inline
vector CcVector.h (1 C, PD)
Vector, quaternion and matrix math
vector Handmade Math (1 C, PD)
Vector math
vector Hypatia (1 C, MIT)
Vector/matrix/quaternion math
vector Linalg.h (1 C++, PD)
Vector/matrix/quaternion math
vector Linalg (1 C, ISC)
Vector/matrix/quaternion math
video Jo_mpeg original (1 C, PD)
MPEG file writer
video Pl_mpeg (1 C, MIT)
MPEG1 video and audio decoder
xml Pugixml (2 C++, MIT)
Light-weight C++ XML processing library
xml Tinyxml2 (2 C++, ZLIB)
Simple, small, efficient, C++ XML parser
xml Yxml (2 C, MIT)
Small, fast and correct XML parser
yaml Mini-yaml (2 C++, MIT)
YAML parser and serializer

Secondary listing

Entries in this appendix either do not offer a single-header file directly, or the single-header file is computer generated, or you have to build the single-header by yourself, or lack any other major requirement mentioned above. However, some of you may find the links below still relevant.

tag library
db Sqlite (2 C, PD)
Self-contained, SQL database engine.
engine FWK1(1 C, PD)
3D game framework in C
file DTW (1 C, MIT)
File and folder utilities
net CWebStudio (1 C, MIT)
WebServer with embedded JSON/HTML utilities
pack Zstd (? C, BSD3)
Fast real-time compression algorithm
sys Cpuid (1 C, ???)
Cross-platform cpuid intrinsic
sys Iathook (1 C, ???)
Import address table hooking library (x86/x64,w32)

List FAQ

Can I link directly to this list?

Yes. For historical reasons, this is the preferred link.

Why isn't library XXX which is made of 3 or more files on this list?

We draw the line arbitrarily at 2 files at most. Some of these libraries are still easy to drop into your project and build, so you might still be ok with them. But since people come to stb for single-file public domain libraries, we feel that starts to get too far from what we do here.

Why isn't library XXX which is at most two files and has minimal other dependencies on this list?

Probably because we don't know about it, feel free to submit a pull request or issue (it can be your own library or somebody else's). But we might not include it for various other reasons, including subtleties of what is 'minimal other dependencies' and subtleties about what is 'lightweight'.

What are the differences between C, C++ and C/C++ in the API column?

For the API column, "C" means a C library that may be C++ compatible but this not guaranteed nor verified, "C++" means C++ only and thus not C compatible, and "C/C++" means a C library with additional features when compiled in C++ mode.

Why are the LICENSING terms required in the header and source files?

Please note that every file that must be included in a user's project counts; a header and a source file is 2 files, but a header file, source file, and LICENSE (if the license isn't in the source file) is 3 files, and won't be accepted, because it's not 2 files. But actually 'LICENSE' is a problem for just dropping the library in a source tree anyway, since it's not scoped to just the library, so library authors are encouraged to include the license in the source file and not require a separate LICENSE.

About

List of single-file C/C++ libraries.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published