A simple way to enforce (standard) header include order?

This page summarizes the projects mentioned and recommended in the original post on /r/cpp_questions

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • ssgl

    single source shaders for opengl

  • I have a library that due to its nature (it defines a domain-specific language within C++) has to define macros for a bunch of words that some standard headers use as variable names. This causes the standard headers to completely break if my library headers are included before them, and the errors are less than intuitive. Is there a simple way to produce a meaningful error (like "library header must be included last") if a standard header is included after the library headers? Googling didn't help much, and at a quick glance standard headers don't appear to contain too many extremely common names that I could #define to static_assert or something. I'm fine with the sensible error being limited to a few of the big standard implementations, so the option of just going through the headers and finding enough such names is doable, but it'd be nice to have a cleaner solution.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts