C++ header-only

Open-source C++ projects categorized as header-only | Edit details
Related topics: #CPP #Cpp17 #Cpp11 #C++ #Cpp14

Top 23 C++ header-only Projects

  • GitHub repo json

    JSON for Modern C++

    Project mention: How to save whatever the user put into a variable so the variable can keep that info the next time the user starts the app | reddit.com/r/cpp | 2021-11-03
  • GitHub repo Catch

    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)

    Project mention: Oof: Manipulate (RGB) color, position and more of console output in a single C++ header library | reddit.com/r/cpp | 2021-11-21

    I'll just give you two links: CMake tutorial: https://cmake.org/cmake/help/latest/guide/tutorial/index.html . Shouldn't take years to complete Catch2 doc: https://github.com/catchorg/Catch2/blob/devel/docs/migrate-v2-to-v3.md . They briefly explain why they finally moved away from header only

  • Scout APM

    Scout APM: A developer's best friend. Try free for 14-days. 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: Build2 seems to have the right idea. | reddit.com/r/cpp | 2021-11-19

    I've also seen things in build2 recipes involving gcc or MSVC compiler switches. Admittedly, the CMake script for spdlog is also quite complex. But I think that's because it's covering a lot of possibilities of how its dependencies are built that build2, by the sounds of it, ought not have to worry about. CMake gives you platform independent ways to set features on targets so that, in theory at least, you write your build script once and it automatically works across multiple platforms.

  • GitHub repo Crow

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

    Project mention: RESTful API framework | reddit.com/r/cpp_questions | 2021-10-05

    It seems nice, but the framework seems to be dead. There are still open pull requests and the contribution page speaks for itself: https://github.com/ipkn/crow/graphs/contributors

  • GitHub repo cpp-httplib

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

    Project mention: Crow finally gets rid of `CROW_MAIN` macro | reddit.com/r/cpp | 2021-11-24

    I went with cpp-httplib instead, also partially because it lets me seperate the cpp from the h header only library (I despise this trend of header only libraries blowing up compile times). But now that crowcpp is getting new manpower behind it, I will seriously consider it, partially because handles url arguments better.

  • GitHub repo entt

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

    Project mention: I wrote a simple Go->C++ compiler to use for gameplay programming. Here's a demo of its use for my game project (along with an editor tool). I show the generated C++ in the end of the video. Compiler source code is ~1500 lines, link in video description. Will do a deeper public release soon! | reddit.com/r/golang | 2021-11-25

    Interop: With this compiler I have direct interop to existing C++ libraries and codebases. For example I use EnTT for the entity-component data storage in the game demo here, and I'm able to call to the C++ including Go's generic syntax translating to template calls. That's not as easy with Cgo (and also Cgo adds huge overhead)

  • GitHub repo GuiLite

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

    Project mention: GUI? | reddit.com/r/cpp | 2021-07-29

    How about Nana? or GuiLite?

  • Nanos

    Run Linux Software Faster and Safer than Linux with Unikernels.

  • GitHub repo GLM

    OpenGL Mathematics (GLM)

    Project mention: Any OpenGL implementations for vector-drawing hardware? | reddit.com/r/opengl | 2021-11-19

    For rendering 3D wireframes in general, involving OpenGL would overcomplicate things. Instead, you might want to look at GLM, the 3rd-party math library that many modern OpenGL apps use (because OpenGL no longer takes responsibility for any CPU-side matrix math). With GLM, in a few lines of code, you can throw 3D lines at some camera matrices and get output you can put on screen. More work would still be needed to do things like clipping/culling or opaque triangles, but that's basic 3D coding, and nothing compared to digging into the guts of an OpenGL software renderer.

  • GitHub repo doctest

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

    Project mention: Unit testing and mocking for c++ | reddit.com/r/cpp | 2021-10-19

    I usually use doctest with trompeloeil.

  • 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: Circle, the C++ Automation Language | news.ycombinator.com | 2021-10-16
  • GitHub repo compile-time-regular-expressions

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

    Project mention: Stringy Templates | reddit.com/r/cpp | 2021-10-23

    On the topic of wild things done with compile time strings, check out /u/hanickadot's compile-time regular expressions if you haven't already, it's mind-blowing

  • GitHub repo indicators

    Activity Indicators for Modern C++

    Project mention: It there a library for creating a progress bar? | reddit.com/r/cpp_questions | 2021-03-31

    Maybe this one: https://github.com/p-ranav/indicators

  • GitHub repo FunctionalPlus

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

    Project mention: Why C++ for everything? | reddit.com/r/ROS | 2021-04-28

    As idiomatic, I will try to adopt as much as possible purely functional programming in C++ by using https://github.com/Dobiasd/FunctionalPlus . Do you have by any chance any alternative suggestion?

  • GitHub repo PEGTL

    Parsing Expression Grammar Template Library

    Project mention: We Built a C++ Rendering Engine for the Web | news.ycombinator.com | 2021-07-10

    As a professional C++ programmer I feel a lot of the reasons C++ gets this response is because it's simply not "batteries included" like Go or Rust.

    C++ is a very powerful, unopinionated language, that gives you a lot of freedom to attack your problem domain the way you best see fit.

    If you're writing a networked application, don't use POSIX sockets, go and find a higher level library. If you're parsing complex text formats, don't iterate over buffers with char*'s, go pick up PEGTL[0]. If you're working on graphs, or need to properly index in-memory data, go pick up Boost[1][2]. If you need a GUI, go pick up Qt.

    It's extremely common in C++, due to the lack of a universal package management solution, for people to try and "muddle through" and do shit themselves when it's far outside their core competency.

    At one of my last employers, the core product was parsing JSON with std::regex, simply because they couldn't be bothered to integrate a JSON library.

    [0] https://github.com/taocpp/PEGTL

    [1] https://www.boost.org/doc/libs/1_76_0/libs/graph/

    [2] https://www.boost.org/doc/libs/1_76_0/libs/multi_index/doc/i...

  • GitHub repo uvw

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

    Project mention: I hate ASIO and I can't be alone. | reddit.com/r/cpp | 2021-08-14

    Have you tried this wrapper? https://github.com/skypjack/uvw

  • GitHub repo hana

    Your standard library for metaprogramming

    Project mention: Simple `struct` static reflection system I use that tracks names, attributes (in my own code I also keep `constexpr` hashes of names) -- example gets fully inlined into `main()` | reddit.com/r/cpp | 2021-04-24

    And then there's also the longstanding issue with default member initializers -- https://github.com/boostorg/hana/issues/409 -- which was a deal-breaker.The PROP system avoids this issue precisely by having the macro be as local as possible: the default member initializer is outside the macro. It does this while still letting you attach additional PropAttribs metadata (I'm not sure what additional metadata attachment looks like in Hana? haven't really tried). Default values and additional attributes are by and large quite more important to me in my use cases for reflection (component types in game ECS) than range syntax (everything I've needed and can think of needing is covered by for-each loop).

  • GitHub repo plog

    Portable, simple and extensible C++ logging library

  • GitHub repo mio

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

    Project mention: Fastest way to read very large file(Gb to Tb) in C++ | reddit.com/r/cpp | 2021-05-19

    I would memory map it. Use this lib: https://github.com/mandreyel/mio

  • GitHub repo Nameof C++

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

    Project mention: Getting an Unmangled Type Name at Compile Time | reddit.com/r/cpp | 2021-03-10
  • GitHub repo Better Enums

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

  • GitHub repo robin-hood-hashing

    Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20

    Project mention: Nanobench: Fast, Accurate, Single-Header Microbenchmarking Functionality For C++ | reddit.com/r/cpp | 2021-11-09

    Big fan. Nanobench and robin-hood-hashing are frequent uses for me.

  • GitHub repo Argh!

    Argh! A minimalist argument handler. (by adishavit)

  • GitHub repo Inja

    A Template Engine for Modern C++

    Project mention: Looking for a codegen library that uses C++ for scripting | reddit.com/r/cpp | 2021-03-10

    I've looked into a newer template engine like Inja, but my client isn't quite happy with that either. Inja allows you to write templates that you feed JSON data into:

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-11-25.

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 27,595
2 Catch 14,268
3 spdlog 13,227
4 Crow 6,606
5 cpp-httplib 6,048
6 entt 5,961
7 GuiLite 5,794
8 GLM 5,719
9 doctest 3,544
10 Magic Enum C++ 2,297
11 compile-time-regular-expressions 2,112
12 indicators 1,811
13 FunctionalPlus 1,512
14 PEGTL 1,437
15 uvw 1,343
16 hana 1,321
17 plog 1,259
18 mio 1,209
19 Nameof C++ 1,201
20 Better Enums 1,192
21 robin-hood-hashing 951
22 Argh! 901
23 Inja 849
Find remote jobs at our new job board 99remotejobs.com. There are 33 new remote jobs listed recently.
Are you hiring? Post a new remote job listing for free.
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives