C++ header-only

Open-source C++ projects categorized as header-only

Top 23 C++ header-only Projects

  • GitHub repo json

    JSON for Modern C++

    Project mention: C++ trainable semantic segmentation models | reddit.com/r/computervision | 2021-02-23

    This project is under developing. By now, these projects helps a lot. - official pytorch - qubvel SMP - nlohmann json

  • GitHub repo Catch

    A modern, C++-native, header-only, test framework for unit-tests, TDD and BDD - using C++11, C++14, C++17 and later (or C++03 on the Catch1.x branch)

    Project mention: !false doesn't have to be true in C++ | reddit.com/r/programming | 2021-01-20
  • Scout

    Get performance insights in less than 4 minutes. Scout APM uses tracing logic that ties bottlenecks to source code so you know the exact line of code causing performance issues and can get back to building a great product faster.

  • GitHub repo spdlog

    Fast C++ logging library.

    Project mention: [C++20] Simple-Log - multithreaded logging library | reddit.com/r/cpp | 2021-02-23

    For me, spdlog is my go-to choice. How does this compare to that? What features do you have planned that might differentiate it?

  • GitHub repo Crow

    Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)

  • GitHub repo GuiLite

    ✔️The smallest header-only GUI library(4 KLOC) for all platforms

    Project mention: Deeply understand your GitHub/GitLab project | reddit.com/r/github | 2021-01-17

    You can get source code here

  • GitHub repo GLM

    OpenGL Mathematics (GLM)

    Project mention: Nyx: 3rd party libraries | dev.to | 2021-01-13

    glm [link]

  • GitHub repo entt

    Gaming meets modern C++ - a fast and reliable entity component system (ECS) and much more

    Project mention: I need help understanding ECS. | reddit.com/r/gamedev | 2021-02-21

    You should probably look at something like Entt. It's C++, though. I assume you use C based from your sample code.

  • GitHub repo cpp-httplib

    A C++ header-only HTTP/HTTPS server and client library

    Project mention: What's the simplest way of sending POST/GET requests? | reddit.com/r/cpp | 2021-02-05
  • GitHub repo doctest

    The fastest feature-rich C++11/14/17/20 single-header testing framework

    Project mention: A header only library for C++ programming language Libr | reddit.com/r/cpp | 2021-01-25

    I really recommend you checkout doctest https://github.com/onqtam/doctest first

  • GitHub repo compile-time-regular-expressions

    A Compile time PCRE (almost) compatible regular expression matcher.

    Project mention: Regular Expression COmpiler - Compile a regex ahead of time to code | reddit.com/r/coding | 2021-02-03

    CTRE is great for C++

  • GitHub repo Magic Enum C++

    Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code

    Project mention: finally! a possibly portable way to convert types (demangled name) to strings without macros | reddit.com/r/cpp | 2021-02-08

    But sure I expect people will try all sorts of tricks. Like this one from magic_enum to get the enum string name via a function signature.

  • GitHub repo indicators

    Activity Indicators for Modern C++

    Project mention: A Simple library for progress bars in C++ | reddit.com/r/cpp | 2021-01-13

    p-ranav/indicators offers a very rich api but this is definitely simpler to use.

  • GitHub repo PEGTL

    Parsing Expression Grammar Template Library

    Project mention: Ask HN: C++17/C++20 example projects with good style? | news.ycombinator.com | 2021-02-06

    A list of modern C++ related resources can be found here:


    The list includes some powerful yet not excessively large libraries including:




  • GitHub repo FunctionalPlus

    Functional Programming Library for C++. Write concise and readable C++ code.

    Project mention: Integrating sanitizers into your CI workflow | reddit.com/r/cpp | 2021-02-18

    Another option is to use a superbuild CML where you can do all the nasty, platform specific things. Example of a superbuild CML.

  • GitHub repo uvw

    Header-only, event based, tiny and easy to use libuv wrapper in modern C++ - now available as also shared/static library!

  • GitHub repo hana

    Your standard library for metaprogramming

    Project mention: cppa2z - Document modern C++ using unit tests | reddit.com/r/cpp | 2021-01-31

    oh yes definitely, but I meant more the particular way I've done it so far - which has been to implement something similar to boost::hana::is_valid(), to make it take the least amount of boilerplate code per-use-case as possible: zero additional lines of code.

  • GitHub repo Better Enums

    C++ compile-time enum to string, iteration, in a single header file

  • GitHub repo plog

    Portable, simple and extensible C++ logging library

  • GitHub repo Nameof C++

    Nameof operator for modern C++, simply obtain the name of a variable, type, function, macro, and enum

  • GitHub repo Argh!

    Argh! A minimalist argument handler.

  • GitHub repo frugally-deep

    Header-only library for using Keras models in C++.

  • GitHub repo Inja

    A Template Engine for Modern C++

  • GitHub repo clipp

    easy to use, powerful & expressive command line argument parsing for modern C++ / single header / usage & doc generation

NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020). The latest post mention was on 2021-02-23.


What are some of the best open-source header-only projects in C++? This list will help you:

Project Stars
1 json 23,244
2 Catch 12,784
3 spdlog 10,962
4 Crow 6,201
5 GuiLite 5,246
6 GLM 4,861
7 entt 4,851
8 cpp-httplib 4,462
9 doctest 3,087
10 compile-time-regular-expressions 1,771
11 Magic Enum C++ 1,633
12 indicators 1,410
13 PEGTL 1,276
14 FunctionalPlus 1,252
15 uvw 1,211
16 hana 1,196
17 Better Enums 1,086
18 plog 1,043
19 Nameof C++ 988
20 Argh! 741
21 frugally-deep 705
22 Inja 690
23 clipp 675