C++ header-only

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

Top 23 C++ header-only Projects

  • json

    JSON for Modern C++

    Project mention: Good repos for beginners to browse that follow best modern C++ practices (including testing, static analysis etc...) | reddit.com/r/cpp | 2022-11-24

    I always recommend https://github.com/nlohmann/json

  • spdlog

    Fast C++ logging library.

    Project mention: I want to slightly change the behavior of the std::cout | reddit.com/r/cpp_questions | 2022-10-21

    Typically, you'd use a logging library to handle stuff like this. I personally like spdlog. You use different logger functions (info, warn, error) and depending on what level you have set for the logger (or globally) some of the functions become no-ops. E.g. When not running in verbose mode all spdlog::info() do nothing.

  • Sonar

    Free webinar: The Power of Clean C++. Are you ready to take your C++ code to the next level? Join Sonar on December 7th for our live webinar as we discuss how to get your code clean - and stay clean - with minimal effort and without being overloaded with warnings. Register now!

  • cpp-httplib

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

    Project mention: Issues with libssl on Mac | reddit.com/r/cpp_questions | 2022-11-14

    I'm new to C++, and have been trying to make a simple HTTP request. I stumbled on cpp-httplib and decided to try it out.

  • entt

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

    Project mention: Enums In C++, Choice is Oft Beguiled | reddit.com/r/cpp | 2022-11-18

    Now you can make use of operator| and operator&. Here is the full source. It'll be a bit better when it's ported to C++20 with concepts, as the SFINAE produces the usual ugly error messages with enable_if.

  • Crow

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

    Project mention: C++ to Browser JS Framework Recommendations | reddit.com/r/cpp | 2022-08-06

    Open socket, serve a html page, implement GET/PUT or find framework that do https://github.com/ipkn/crow

  • GLM

    OpenGL Mathematics (GLM)

    Project mention: how to include glm with cmake (and other headers / static libraries) | reddit.com/r/learnprogramming | 2022-10-02

    But now I'm kinda stuck on glm. I downloaded it from the official website and grabbed the glm subdirectory with the header files. (https://github.com/g-truc/glm/releases/tag/ It also contains a CMakeLists.txt which i should be able to include in my project CMakeLists.txt.

  • GuiLite

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

    Project mention: Does anyone have feedback on working with GuiLite? | reddit.com/r/cpp_questions | 2022-04-08
  • Scout APM

    Truly a developer’s best friend. Scout APM is great for developers who want to find and fix performance issues in their applications. With Scout, we'll take care of the bugs so you can focus on building great things 🚀.

  • doctest

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

    Project mention: Memory Safety in the D Programming Language (Part 2 of N) | reddit.com/r/programming | 2022-10-08

    This is, honestly, super easy to get going. Nowadays you have a ton of libraries and more-than-decent build systems. With Meson/CMake and Conan/Vcpkg I can set up a project with testing in 3 minutes. Also, I think that at the end of the day you want your tests to live somewhere else. But if you want to embed them, you also have https://github.com/doctest/doctest.


    Features: - Functional style. Inspired by [1] and React - Simple and elegant syntax (in my opinion). - Support for UTF8 and fullwidth chars (→ 测试). - No dependencies. - Cross platform. Linux/mac (main target), Windows (experimental thanks to contributors), - WebAssembly. - Keyboard & mouse navigation. Operating systems: - linux emscripten - linux gcc - linux clang - windows msvc - mac clang

    Project mention: Cross Platform Terminal UI Toolkit for .NET | news.ycombinator.com | 2022-10-13

    On the C++ front, I've been using this and love it - https://github.com/ArthurSonzogni/FTXUI - it also has wasm target, so may target the web.

    I'm regular Far Commander on Windows, and Midnight Commander, also known as mc on Linux/OSX. In fact my "Command-Prompt" on Windows is always FAR (this comes with certain limitations, but I'm so used to it, I can't do my normal work without it). I could never get into the Explorer, and only use it in rare cases.

  • 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: Error: Boost bimap can't convert const CompatibleKey to Key& | reddit.com/r/cpp_questions | 2022-11-22

    Also if you want to convert enum members to string representation I suggest you just use magic_enum instead, much smaller dependency.

  • compile-time-regular-expressions

    Compile Time Regular Expression in C++

    Project mention: Regex is comically slow. High performance alternatives? (Pattern matching for validation) | reddit.com/r/cpp_questions | 2022-11-19
  • indicators

    Activity Indicators for Modern C++

    Project mention: Libraries | reddit.com/r/cpp_questions | 2021-12-07


  • palanteer

    Visual Python and C++ nanosecond profiler, logger, tests enabler

  • FunctionalPlus

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

    Project mention: C++20 Ranges The Key Advantage - Algorithm Composition | reddit.com/r/cpp | 2022-03-28

    I use a library called FunctionalPlus daily.


    Parsing Expression Grammar Template Library

    Project mention: What are some cool modern libraries you enjoy using? | reddit.com/r/cpp | 2022-09-18

    I like PEGTL

  • plog

    Portable, simple and extensible C++ logging library

    Project mention: Show timestamp before every output line in Qt Application Output. | reddit.com/r/QtFramework | 2022-09-22
  • uvw

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

  • argparse

    Argument Parser for Modern C++

    Project mention: argparse v2.9 released - now with support for subcommands, nargs, prefix_chars, metavar, parse_known_args, improved help messages and more | reddit.com/r/cpp | 2022-09-22
  • Nameof C++

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

    Project mention: Added reflection to C++ just to make my game work. | reddit.com/r/gamedev | 2022-10-27

    In general, nameof for reflection

  • cppzmq

    Header-only C++ binding for libzmq

    Project mention: Any good lightweight c++ local socket library for embedded Linux? | reddit.com/r/cpp_questions | 2022-05-10

    Maybe I am not understanding it correctly, the https://github.com/zeromq/libzmq is GPL v3, and header only file is https://github.com/zeromq/cppzmq MIT license? So I can use the header only library and I don't need to open source my code?

  • hana

    Your standard library for metaprogramming

  • mio

    Cross-platform C++11 header-only library for memory mapped file IO (by mandreyel)

    Project mention: Why are people willing to pay 100$ a year for an IDE? | reddit.com/r/Cplusplus | 2022-09-27
  • Better Enums

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

    Project mention: What are some cool modern libraries you enjoy using? | reddit.com/r/cpp | 2022-09-18
  • Zigi

    The context switching struggle is real. Zigi makes context switching a thing of the past. It monitors Jira and GitHub updates, pings you when PRs need approval and lets you take fast actions - all directly from Slack!

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 2022-11-24.

C++ header-only related posts


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

Project Stars
1 json 32,634
2 spdlog 16,219
3 cpp-httplib 8,139
4 entt 7,400
5 Crow 6,998
6 GLM 6,954
7 GuiLite 6,529
8 doctest 4,374
9 FTXUI 3,802
10 Magic Enum C++ 3,222
11 compile-time-regular-expressions 2,558
12 indicators 2,201
13 palanteer 1,930
14 FunctionalPlus 1,722
15 PEGTL 1,630
16 plog 1,591
17 uvw 1,515
18 argparse 1,482
19 Nameof C++ 1,475
20 cppzmq 1,440
21 hana 1,434
22 mio 1,383
23 Better Enums 1,344
Build time-series-based applications quickly and at scale.
InfluxDB is the Time Series Data Platform where developers build real-time applications for analytics, IoT and cloud-native services in less time with less code.