r/cpp_questions 9d ago

OPEN What’s the state of modules

I’ve been hearing about modules since a while now and I can’t seem to find any serious project on the internet using modules. I assume compilers still don’t fully support modules…

5 Upvotes

13 comments sorted by

View all comments

3

u/NeuroSynchroBonding 9d ago

Compilers do fully support modules. Clang + CMake has been working well for me, but it is worth noting that CMake does not support "header units", which means you can't write import <header.h>. But you can still include headers in the global module fragment like this:

``` module;

include <header.h>

export module ModOne; // Module code here... ```