Skip to content

List of single-file C/C++ libraries, with emphasis on clause-less licenses.

Notifications You must be signed in to change notification settings

r-lyeh/single_file_libs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Repository files navigation

Discord

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.

taglibrarydescription
2dBlendish (1 C, MIT)Blender-style widget rendering using NanoVG
2dC-Turtle (1 C++, MIT)Port of Python's Turtle to C++
2dCgl (2 C, MIT)C Game Library
2dCimg (1 C++, CeCILL)Image processing toolkit (60K LoC)
2dColourblind (1 C, ISC)Simulating colourblindness
2dDaisy (1 C++, MIT)2D Graphics and text
2dGlyType (1, C, WTFPL2)Ultra lightweight font renderer
2dImmediate2D (2 C++, PD)Zero-configuration, immediate-mode 2D graphics for Windows
2dM_image.h (1 C, ZLIB)Image processing routines
2dRFont (1 C, ZLIB)Simple-to-use lightweight single header modular font rendering library
2dRGL (1 C, ZLIB)Simple ultra-lightweight OpenGL version abstraction based on RLGL (pipeline system)
2dScalable-font2 (1 C, MIT)Scalable Font renderer + specification
2dSi_normalmap(1 C, PD)Image to Normal Map generator
2dTigr (2 C, PD)Windowing, text and graphics for Windows, Linux and macOS
2dWfc (1 C, MIT)Generate image locally similar to the input image using WFC algorithm
3dDebug-draw (1 C++, PD)API-agnostic immediate-mode debug rendering
3dLightmapper(1 C, PD)Use your OpenGL renderer to offline bake lightmaps
3dMikktspace (2 C, ZLIB)Compute tangent space for normal mapping
3dModel3d (1 C, MIT)3D model format specification
3dSeamoptimizer(1 C, PD)Modify lightmap data to hide seams
3dSimple OpenGL Loader (1 C, MIT)Extensible, cross-platform OpenGL loader
3dSmall3dlib(1 C, CC0)Fast and portable software renderer
3dStb_voxel_render(1 C, PD)Minecraft-esque voxel rendering "engine" with many more features
3dSwarmz (1 C++, PD)Swarming/flocking algorithm
3dTinygizmo (2 C++, PD)Gizmo objects for interactively editing 3d transformations
3dVertex Cache Optimizer(1 C, PD)Vertex cache optimization of meshes
3dVulkan Memory Allocator (1 C, MIT)Memory allocator for Vulkan
3dZLight (1 C, ZLIB)Software rendering with depth, light and shadow
aiGenann (2 C, ZLIB)Simple neural networks (ANN)
aiKANN (2 C, MIT)Automatic differentiation (2 files)
appRGFW (1 C, ZLIB)A multi-platform single-header user-friendly GUI framework as an alternative to GLFW
argvArgh! (1 C++, BSD)Command-line argument parsing
argvClara (1 C++, BOOST)Composable, command line parser for C++ 11 and beyond
argvCLI11 (1 C++, BSD)Feature-rich CLI parsing in modern C++11
argvCmdline (1 C++, BSD)Command-line argument parsing
argvFlags (1 C++, PD)Command-line argument parsing
argvKgflags (1 C, MIT)Command-line argument parsing
argvLinkom (1 C, MIT)Command-line argument parsing w/ DOS-style options
argvOptionparser (1 C++, MIT)Command-line argument parsing
argvParg (2 C, PD)Command-line argument parsing
argvProgramOptions.hxx (1 C++, MIT)Command-line argument parsing
asmChasm (2 C, PD)Runtime X64 assembler
audioAtomix(1 C, PD)Wait-free atomic sound mixer
audioAw_ima.h (1 C, MIT)IMA-ADPCM audio decoder
audioBtac1c (1 C, MIT)MS-IMA_ADPCM variant
audioChibi-xmplay (2 C, BSD3)XM module playback library
audioclownresampler(1 C, BSD0)Audio resampling
audioMiniaudio (2 C, PD)Audio playback and capture library
audioMiniflac(1 C, BSD0)FLAC decoder with a push-style API
audioMinimp3(1 C, CC0)Minimalistic MP3 decoder with sse/neon support
audioMojoAL (1 C, ZLIB)Full OpenAL 1.1 implementation
audioNanoalsa (1 C, MIT)Tiny PCM playback under Linux
audioOrganya.h(1 C, BSD0)Organya/OrgMaker music renderer
audioPocketmod (1 C, MIT)ProTracker MOD file renderer
audioStb_hexwave(1 C, PD)Audio waveform synthesizer
audioStb_vorbis(1 C, PD)Decode ogg vorbis files from file/memory to float/16-bit signed output
audioTflac(1 C, BSD0)Freestanding FLAC encoding library in C89
audioTinySoundFont (1 C, MIT)SoundFont2 loader & synthesizer
benchPicobench (1 C++, MIT)Microbenchmarking
benchUbench.h(1 C, PD)Microbenchmarking
cErrnoname (2 C, BSD0)Extended errno messages
cMinicoro(1 C, PD-0MIT)Stackful cross-platform coroutine library
cStb_sprintf(1 C, PD)Fast sprintf, snprintf for C/C++
cppFilesystem (1 C++, MIT)Implementation of std::filesystem
cppOutcome (1 C++, APACHE2-BOOST)Outcome and result C++ containers
cryptGgentropy (2 C++, ISC)Cross platform entropy library
cryptMonocypher (2 C, PD)High-quality small cryptography library
cryptRandom3(1 C, PD)Crypt-random generator
cryptTweetNaCl (2 C, PD)High-quality tiny cryptography library
csvCSVstream (1 C++, MIT)CSV parser
csvFast C++ CSV Parser (1 C++, BSD)CSV parser
csvRapidcsv (1 C++, BSD)CSV parser
csvVince's CSV Parser (1 C++, MIT)CSV parser and serializer
dateDate (1 C++, MIT)Date and time libraries
debugB_stacktrace (1 C, MIT)Stack tracing
debugDbgtools (2 C, ZLIB)Cross-platform debug util libraries
debugDebug-assert (1 C++, ZLIB)Modular assertion macro
debugDebugbreak (1 C, BSD)Programmatic debug break
debugLoguru (1 C++, PD)Flexible logging
debugPempek_assert.cpp (2 C++, WTFPL2)Flexible assertions
devLibue (1 C, MIT)Helper library for Linux device hot-plug event
dsAArray(1 C, PD)Arrays/strings: generic, safe
dsAvl (2 C, PD)AVL tree
dsConvenient Containers (1 C, MIT)Typesafe data structures (vector, list, map, set, string, etc.) with a fully generic API and no boilerplate
dsDG_dynarr.h(1 C, PD)Typesafe dynamic arrays (like std::vector) for plain C
dsDynarr(1 C, PD)Dynamic array container
dsDynaVar (1 C++, GPL3)Object which can store any type of primitive data type
dsFifo_declare.h (1 C, LGPL2)Thread/core safe FIFO
dsHashmap (1 C, BSD0)Type-safe hashmaps
dsItlib (1 C++, MIT)Several C++11 standard-contaner-like libraries and helpers
dsJhr_skip_list (1 C++, PD)Skip Lists
dsJrsl(1 C, PD)Skip Lists
dsKlib (2 C, MIT)Many 2-file libs: hash, sort, b-tree, etc
dsLibintrusive (2 C, PD)Intrusive data structures
dsLibpqueue (2 C, BSD)Priority queue (heap)
dsLinkedList (2 C, MIT)Linked list C++
dsMempool (1 C++, MIT)Efficient minimal memory pool implementation for C++
dsPackedArray (2 C, WTFPL2)Memory-efficient array of elements with non-pow2 bitcount
dsSelist (2 C, ISC)Space-efficient linked-list
dsSimclist (2 C, BSD)Linked-list
dsStb_ds(1 C, PD)Typesafe dynamic array and hash tables for C, will compile in C++
dsUthash (2 C, BSD)Several 1-header, 1-license-file libs: generic hash, list, etc
dsVector (1 C, BSD0)Type-safe dynamic arrays
dsVerstable (1 C, MIT)High performance and typesafe generic hash table
dsYar(1 C, PD)Type-safe dynamic arrays in C
engineKit(1 C, PD)Tiny library for making small games with big pixels
engineOlcPixelGameEngine (1 C++, BSD3)Game engine
enginePunity (1 C, MIT)A tiny game engine in C
fileByteArray (2 C, GPL3)Library to read, write and print binary files
fileDirent (1 C, MIT)Dirent for Windows: retrieve file & dir info
fileMiniphysfs (1 C, ZLIB)Single-file port of PhysFS, a fs/zip abstraction
fileTfile (1 C++, MIT)FILE* wrapper does read-write-append-seek-close (Win/Mac/Unix)
fileTinyDir (1 C, BSD)Cross-platform directory reading (Win/POSIX/MinGW)
fileWhereami (2 C, WTFPL2)Get path/filename of executable or module
fontBlit-fonts (1 C, ISC)Bitmap font blitters
fontSsfn.h (1 C, MIT)Scalable/bitmap/pixmap font renderer
fontStb_easy_font(1 C, PD)Quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc
fontStb_truetype(1 C, PD)Parse, decode, and rasterize characters from truetype fonts
gameRaycastlib.h(1 C, CC0)Advanced raycasting rendering library, pure C99 with no dependencies, only 32bit int math
gameRoguelike.h (1 C, MIT)Simple game library for Roguelike games: pathfinding, Dijkstra graphs, dungeon generation...
gameStb_connected_components(1 C, PD)Incrementally compute reachability on grids
gameStb_herringbone_wang_tile(1 C, PD)Herringbone Wang tile map generator
gameStb_tilemap_editor(1 C, PD)Embeddable tilemap editor
gpuCds_gpubuf(1 C, PD)Compress/interleave arrays from/into GPU buffers.
hashHash.c (2 C, PD)SHA1/SHA3/MD5 hashes
hashLonesha256(1 C, PD)SHA256 implementation
hashPicoSHA2 (1 C++, MIT)SHA256 implementation
hashXxHash (2 C, BSD)Fast hash function
imageBitmap (1 C++, MIT)Bitmap decoder and utilities
imageCro_mipmap.h(1 C, PD)Average, min, max mipmap generators
imageFramepacker (1 C++, MIT)Texture bin packing algorithm
imageJo_sift(1 C, PD)Image feature detection and matching
imageStb_image(1 C, PD)Image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
imageStb_image_resize(1 C, PD)Resize images larger/smaller with good quality
imageStb_image_write(1 C, PD)Image writing to disk: PNG, TGA, BMP
imageStb_perlin(1 C, PD)Perlin's revised simplex noise w/ different seeds
imageStb_rect_pack(1 C, PD)Simple 2D rectangle packer with decent quality
imageTiffloader (2 C, PD)TIFF image loader
imageEXR Miniexr (2 C++, PD)OpenEXR writer, needs header file
imageEXR Tinyexr (1 C, BSD)EXR image read/write, uses miniz internally
imageGIF Gif.h (1 C++, PD)Animated GIF writer (can only include once)
imageGIF Gif_load(1 C, PD)(animated) GIF reader
imageGIF Jo_gif.cpp (1 C++, PD)Animated GIF writer (CPP file can also be used as H file)
imageGIF msf_gif.h(1 C, PD)Animated GIF writer
imageJPG Jpeg-compressor (2 C++, PD)2-file JPEG compress, 2-file JPEG decompress
imageJPG NanoJPEG (1 C, MIT)JPEG decoder
imageJPG Tiny_jpeg.h(1 C, PD)JPEG encoder
imageJPG EXIF Easyexif (2 C++, BSD2)EXIF metadata extractor for JPEG images
imageJPG EXIF TinyEXIF (2 C++, BSD)Parse EXIF data from JPEG (XMP w/ TinyXML2 lib)
imagePDF PDFgen (2 C, PD)PDF writer
imagePNG Lodepng (2 C, ZLIB)PNG encoder/decoder
imagePNG Picopng.cpp (2 C++, ZLIB)Tiny PNG loader
imagePNG TinyPngOutput (2 C, LGPLv3)PNG writer
imagePNM PNM (1 C++, APACHE2)PBM, PGM and PPM reader and writer
imageSVG NanoSVG (1 C, ZLIB)1-file SVG parser; 1-file SVG rasterizer
imageWEBP Jebp(1 C, 0MIT)Single header WebP decoder (only supports lossless images)
imageWEBP tiny-webp (1 C, BSD3)Single header WebP decoder
iniInih (2 C, BSD).ini file parser
inputEasyTab(1 C, PD)Multi-platform tablet input
jsonAjson (1 C++, BOOST)JSON serialize & deserialize w/ STL support
jsonCJSON (1 C, MIT)JSON parser
jsonCJSON (1 C, MIT)JSON parser
jsoncsonpath (1 C, BSD3)JsonPath implementation
jsonJsmn (1 C, MIT)Minimalistic JSON parser
jsonJson-build (1 C, MIT)JSON serializer
jsonJson.h(1 C, PD)JSON parser
jsonJson.hpp (1 C++, MIT)JSON parse, serialize, deserialize
jsonJsonc (1 C, MIT)Extremely fast and extremely small (~60 SLoC) JSON parser
jsonJzon.h (2 C++, MIT)JSON parser
jsonParson (2 C, MIT)JSON parser and serializer
jsonPicoJSON (1 C++, BSD)JSON parse/serializer
jsonSjson (1 C, BSD2)JSON encode/decoder
logicFFSM2 (1 C++, MIT)Flat FSM
logicHFSM2 (1 C++, MIT)Hierarchical FSM
mathAmoeba (1 C, MIT)Constraint solver (Cassowary) w/Lua binding
mathCds_spline(1 C, PD)Spline utils
mathCeval-single-header (1 C, MIT)A single-header library for parsing and evaluation of arithmetic expressions
mathClipper (2 C++, BOOST)Line & polygon clipping & offsetting
mathDelaunay (2 C++, BSD3)2D and 3D Delaunay triangulation
mathDelaunay (Constrained)(1 C, PD)2D Constrained Delaunay Triangulation
mathDf(1 C, PD)Find voronoi region in linear time of size of lattice
mathDvector(1 C, PD)2D/3D vector/quaternion/matrix math library
mathExprTk (1 C++, MIT)Runtime mathematical expression parser and evaluation engine.
mathFft (1 C++, PD)Fast Fourier Transform
mathHMM Toolkit (1 C, GPL2)Discrete and continuous Hidden Markov Models (DHMM, CHMM)
mathJc_voronoi (1 C, MIT)Find voronoi regions on float/double data
mathLinmath.h(1 C, WTFPL2)Vector library
mathM_math.h (1 C, ZLIB)Math with C/OpenCL portability
mathMatrix-hpp (1 C++, MIT)Matrix class container for linear algebra computations
mathNanoflann (1 C++, BSD)Build KD trees for point clouds
mathNv_voronoi.h(1 C, PD)Find voronoi regions on lattice w/ integer inputs
mathOmm (1 C++, MIT)Template open multi-methods
mathOpenNL (2 C++, BSD3)Linear and eigen solvers
mathPar_msquares (1 C, MIT)Convert (binarized) image to triangles
mathPar_shapes (1 C, MIT)Generate various 3d geometric shapes
mathPar_streamlines (1 C, MIT)Tessellate wide lines and curves with shading attributes
mathPoissonGenerator.h (1 C++, MIT)Poisson disk points generator (disk or rect)
mathPolyPartition (2 C++, MIT)Polygon triangulation, partitioning
mathPrecision (1 C++, PD)Arbitrary-precision integer and rational arithmetic
mathPrns.h(1 C, PD)Seekable pseudo-random number sequences
mathRfft.h(1 C, PD)Fast Fourier Tranform for arbitrary array sizes
mathSdf.h (1 C, MIT)Compute signed-distance field from antialiased image
mathShaderFastLibs (1 C++, MIT)(also HLSL) Approximate transcendental functions optimized for shaders (esp. GCN)
mathSimple_linear_regression (1 C, MIT)Simple linear regression
mathSimrank.hpp (2 C++, MIT)SimRank graph similarity algorithm
mathsmath (1 C++, APACHE2)Linear algebra math library (C++23)
mathSobol.h(1 C, PD)Sobol & stratified sampling sequences
mathStatistics-Tool-Box(1 C, PD)Statistical functions
mathStb_divide(1 C, PD)More useful 32-bit modulus
mathSummedAreaTable (1 C++, MIT)Summed-Area Table generation and sum/avg queries
mathTinyExpr (2 C, ZLIB)Evaluation of math expressions from strings
mathTomas Akenine-Moller snippets (2 C, PD)Various 3D intersection calculations, not lib-ified
mathVmath(1 C, PD)Vector/matrix library
mathVoxelizer (1 C, MIT)Convert triangle mesh to voxel triangle mesh
mathXatlas (2 C++, MIT)Mesh parameterization
memBuddy_alloc(1 C, BSD0)Buddy memory allocator
memStb_leakcheck(1 C, PD)Quick-and-dirty malloc/free leak-checking
memWb_alloc(1 C, PD)Custom allocators in a single-header
meshCgltf (1 C, MIT)GlTF 2.0 file loader
meshFast_obj.h (1 C, MIT)Wavefront OBJ file loader
meshM3d.h (1 C, MIT)Model 3D importer/exporter (with Blender, Goxel, WebGL JS and assimp integration)
meshObjzero (2 C, MIT)Wavefront OBJ file loader
meshQll_q3.h (1 C++, WTFPL2)Quake3 BSP loader
meshTinyobjloader-c (1 C, MIT)Wavefront OBJ file loader
meshTinyobjloader (1 C++, MIT)Wavefront OBJ file loader
meshTinyply (2 C++, PD)PLY mesh file loader
meshTk_objfile (1 C, MIT)OBJ file loader
miscASAP (1 C++, MIT)Library for parsing, printing, iterating and operating on dates.
miscASN.1 DER (2 C, PD)Encoder/decoder for ASN.1 DER format.
miscCLM_LIBS(1 C, PD)Diverse utilities
miscColor-Toolkit (1 C, GPL2)Color conversion utils (RGB, XYZ, Lab, CIE76, CIE94 and CIEDE200)
miscCpp-generators (1 C++, BSD)Generators in C++
miscEbnn.h (1 C, MIT)BNN (Binarized Neural Networks)
miscH.h (1 C, GPL3)Diverse utilities
miscHedley(1 C, PD)Compiler portability, optimization, static analysis, etc.
miscMakeID.h (1 C++, PD)Allocate/deallocate small integer IDs efficiently
miscMmu (2 C, MIT)Memory management and data structure toolset
miscOpenGA (1 C++, MPL2)A C++ Generic Algorithm solver library
miscPlusCallback (1 C++, ZLIB)Function/method callbacks
miscProcess.h(1 C, PD)Process control API
miscQR-Code-generator (2 C, MIT)QR Code generator
miscQsort (1 C, MIT)Qsort algorithm as a C macro
miscScogem.c (2 C, PD)URL parser
miscSili(1 C, PD)C toolchain for modern C programming, strings, arrays, files, threading, ect
miscSmallxrm.c (2 C, PD)Implementation of X resource manager
miscStb_include(1 C, PD)Implement recursive #include support, particularly for GLSL
miscStmr (2 C, MIT)Extract English word stems
miscX.h (1 C, MULAN2)Cross-platform C/C++ utilities
navM_path_finding.h (1 C, ZLIB)Floodfill-based path finding
navMicropather (2 C++, ZLIB)Pathfinding with A*
netCivetweb (2 C, MIT)HTTP server, fork of Mongoose
netCpp-httplib (1 C, MIT)Cross-platform HTTP server/client
netEnet (1 C, MIT)Reliable UDP networking library
netEWS (1 C, BSD)HTTP server
netHappyhttp (2 C++, ZLIB)HTTP client requests
netLibcluon (1 C++, MPL2)Cross-platform socket wrapper and data marshalling with native implementations for Protobuf, LCM/ZCM, JSON, and MsgPack serialization/deserialization
netLibrg (1 C, BSD3)World/entity synchronization multiplayer library
netLUrlParser (2 C++, MIT)Lightweight URL & URI parser RFC 1738, RFC 3986
netMongoose (2 C, GPLv2)HTTP server
netNetq (1 C, MIT)Reliable datagram library
netPar_easycurl.h (1 C, MIT)CURL wrapper
netSimpletls.c (2 C, PD)Function to create a socket and connect to a remote server with TLS
netSwrap(1 C, PD)TCP and UDP socket wrapper
netTiniest-analytics (2 C++, MIT)Cross-platform analytics for games (using Google Analytics <4)
netTiny-MQTT-c (4 C, PD)Small implementation of (some of) the MQTT protocol in C
netTlse (2 C, PD-BSD2)TLS v1.0, 1.2, 1.3 and DTLS 1.0, 1.2 implementations
netWebster (2 C++, APACHE2)Standalone HTTP server/client
netYocto (2 C, PD)Non-production-use HTTP server
netZed_net(1 C, PD)Cross-platform socket wrapper
netZnet (1 C, MIT)Cross-platform networking w/ Lua binding
nnQmtik (1 C, MIT)Quantized Model Training and Inference Kit
packDmc_unrar (1 C, GPL2)RAR file decompression
packFastlz (2 C, MIT)Fast but larger LZ compression
packLz4 (2 C, BSD)Fast but larger LZ compression
packMicrotar (2 C, MIT)Lightweight tar library
packMiniz.c (1 C, MIT)Compression, decompression, ZIP file, PNG writing
packNibrans(1 C, PD)Adaptive rANS library
packPithy (2 C, BSD)Fast but larger LZ compression
packRle (1 C, MIT)Run-length en/decoder
packStb_dxt(1 C, PD)Real-time DXT compressor
parseCmp (2 C, MIT)MessagePack parser and serializer
parseCpp-peglib (1 C, MIT)PEG (Parsing Expression Grammars) library
parseFuri (1 C, MIT)URL & URI parsing
parseHtml-parse.c (2 C, GPL)HTML parser (wget)
parseSLRE (1 C, GPL2)Regular expression matcher
parseStb_c_lexer(1 C, PD)Simplify writing parsers for C-like languages
parseTok (1 C, MIT)Configurable tokenizer
parseTomlplusplus (1 C++, MIT)TOML parser and serializer
parseUdisasm (1 C, MIT)Extremely small disassembler for ARMv8.2 AArch64 (~65k)
parseUnformat (1 C++, PD)Parses formatted strings (reverse of std::format)
prngRandom (1 C++, MIT)Convenient API for random
prngRanxoshi256(1 C, PD)Xoshiro256 algorithm
prngSimplexNoise (1 C++, BSD2)Collection of noise generators
prngUTL Random (1 C++, MIT)Fast random for Monte-Carlo simulations
profileMicroProfile (4 C++, PD)CPU (and GPU?) profiler, 1-3 header files, uses miniz internally
profileProf (1 C, MIT)Profiler for Linux
profileRemotery (2 C, APACHE2)CPU/GPU profiler Win/Mac/Linux, using web browser for viewer
rasterCanvas_ity (1 C++, ISC)2D rasterizer
regexRemimu(1 C, CC0)Regex engine
scriptDuktape (2 C, MIT)Embeddable JavaScript engine
scriptLIL (2 C, ZLIB)Interpreter for a Tcl-like scripting language
scriptLualite (1 C++, MIT)Generate Lua bindings in C++
scriptMinilua (1 C, MIT)Single-file port of Lua scripting language
scriptMY-BASIC (2 C, MIT)Interpreter for a BASIC dialect scripting language
scriptPicol (1 C, BSD)Interpreter for a Tcl-like scripting language
scriptPocketPy (2 C, MIT)Portable Python 3.x Interpreter in Modern C for Game Scripting
scriptS7 (2 C, BSD)Interpreter for a subset of Scheme (R5RS/R7RS)
scriptXpl(1 C, WTFPL2)X Programming Language
serialArchive (1 C++, PD)Binary serialize & deserlize w/ STL support
serialBlob_tree (1 C++, MIT)Binary tree serializer
serialCista (1 C++, MIT)Cross-platform high performance zero copy C++17 serialization/deserialization
serialLibcluon (1 C++, MPL2)Cross-platform data serialization/deserialization with native implementations for Protobuf, LCM/ZCM, JSON, and MsgPack
serialQserial (1 C++, BSD3)Schema-driven serialization library
serialSerialization helper(1 C, WTFPL2)Serialization helper
serialVisit_struct (2 C++, BOOST)Struct-field reflection
stringCsplit (1 C, MIT)String splitting and processing single-header library
stringDfa (2 C, MIT)Fast UTF-8 decoder (need a header file)
stringGb_string.h(1 C, PD)Dynamic strings
stringGgformat (2 C++, ISC)Printf replacement
stringInja.hpp (1 C++, MIT)Template engine
stringLevenshtein (2 C, MIT)Compute edit distance between two strings
stringObfuscate (1 C++, PD)Guaranteed compile-time string literal obfuscation library for C++14
stringStr.h (1 C++, PD)Simple C++ string type with an optional local buffer
stringStr (2 C, BSD)Yet another string library for C language
stringStr_view.hpp (1 C++, MIT)Null-termination-aware string-view class
stringTinyformat (1 C++, BOOST)Typesafe printf
stringUtf8(1 C, PD)UTF-8 string library
svgSimpleSVG (1 C++, BSD3)Easy to use SVG library
sysDoops(1 C, PD)Event loop library
sysEndianness.h(1 C, PD)Endianness conversion and detection
sysJArgsParser (1 C++, MIT)Arguments parser
sysOpenmodal (1 C, MIT)Native file modals
sysRang (1 C++, PD)Cross-platform colored console text
sysXproc (2 C++, MIT)Foreign Process Information
threadBikeshed.h (1 C, MIT)Cross-platform lock free fixed memory hierarchical work scheduler
threadCds_job (1 C++, PD)Lock-free job queue
threadCds_sync(1 C, PD)Collection of synchronization primitives
threadTinyCThread (2 C, ZLIB)Cross-platform implementation of the C11 Threads API
threadTinyThread++ (2 C++, ZLIB)Cross-platform implementation of the C++11 Threads API
uiClay (1 C, ZLIB)High performance 2D UI layout library
uiDear imgui (9 C++, MIT)An immediate-mode GUI formerly named "ImGui"; 3rd-party C wrapper
uiLibcmdf(1 C, PD)A small library for writing CLI applications
uiLinenoise (2 C, BSD)Terminal readline w/ history etc
uiNuklear(1 C, PD)Minimal GUI toolkit
uiStb_textedit(1 C, PD)Guts of a text editor for games etc implementing them from scratch
uiTinyfiledialogs (2 C, ZLIB)Modal dialogs inc. file open/save (Win/Mac/Linux)
uiWcwidth9 (1 C, APACHE2)Platform independent wcwidth with full unicode 9 support
uiWebview (1 C, MIT)Cross-platform webview library
unitCatch2 (1 C++, BOOST)Unit testing
unitCatch (1 C++, BOOST)Unit testing
unitClove-unit (1 C, MIT)Unit testing
unitDoctest (1 C++, MIT)Unit testing
unitFctx (1 C, BSD)Unit testing
unitGreatest (1 C, ISC)Unit testing
unitHippomocks (1 C++, LGPL)Unit testing
unitLabrat(1 C, PD)Unit testing
unitMinctest (1 C, ZLIB)Unit testing
unitMunit (1 C, MIT)Unit testing
unitPicotest (1 C, MIT)Unit testing
unitRexo(1 C, PD)Framework for C89/C++ featuring automatic registration of tests and a polished API
unitSPUT (1 C, BSD)Unit testing
unitTrompeloeil (1 C++, BOOST)Unit testing
unitUtest.h(1 C, PD)Unit testing
unitUtest (1 C, MIT)Unit testing
unitWalter(1 C, PD)Unit testing
uuidUuid4 (2 C, WTFPL2-MIT)UUID v4 generator
uuidUuid_h (1 C, ZLIB)UUID generator
vectorAlgebra3.h (1 C++, PD)Vector utilities for 2, 3, and 4 element vectors, all inline
vectorCcVector.h(1 C, PD)Vector, quaternion and matrix math
vectorHandmade Math(1 C, PD)Vector math
vectorHypatia (1 C, MIT)Vector/matrix/quaternion math
vectorLinalg.h (1 C++, PD)Vector/matrix/quaternion math
vectorLinalg (1 C, ISC)Vector/matrix/quaternion math
videoJo_mpeg, original(1 C, PD)MPEG file writer
videoPl_mpeg (1 C, MIT)MPEG1 video and audio decoder
xmlPugixml (2 C++, MIT)Light-weight C++ XML processing library
xmlTinyxml2 (2 C++, ZLIB)Simple, small, efficient, C++ XML parser
xmlYxml (2 C, MIT)Small, fast and correct XML parser
yamlMini-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.

taglibrarydescription
dbSqlite (2 C, PD)Self-contained, SQL database engine.
engineFWK1(1 C, PD)3D game framework in C
fileDTW (1 C, MIT)File and folder utilities
netCWebStudio (1 C, MIT)WebServer with embedded JSON/HTML utilities
packZstd (? C, BSD3)Fast real-time compression algorithm
sysCpuid (1 C, ???)Cross-platform cpuid intrinsic
sysIathook (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, with emphasis on clause-less licenses.

Resources

Stars

Watchers

Forks