All this is experimental.
C++20 added the module system (import, export module).
C++23 added import std;
You need at least CMake 4.1, the Ninja Generator and GCC 15+ or Clang 19+
| Example | Description | C++ |
|---|---|---|
| example1_import_std | import std; |
23 |
| example2_import_glm | importing a third-party module | 20 |
| example3_import_custom | writing your own module | 20 |
| example4_import_vulkan | importing a third-party module with partitions | 23 |
| example5_import_wgpu | importing a pre-built module target requiring C++20, mixed with a C++23 consumer | 23 |
# all examples
sudo apt install cmake ninja-build
# GCC
sudo apt install g++
# Clang
sudo apt install clang libc++-dev
# example2 import glm
sudo apt install libglm-dev
# example4 import vulkan
sudo apt install libvulkan-dev
# example5 import wgpu
sudo apt install libwebgpu-dawn-dev# GCC
cmake -B build -S example -G Ninja && cmake --build build
# Clang
CC=clang CXX=clang++ cmake -B build -S example -G Ninja && cmake --build build
# run
./build/helloCheck which packages contain C++ module interface files (.cppm and .ixx are the same thing, the extension just isn't standardized yet)
https://packages.debian.org/search?searchon=contents&keywords=ixx&mode=path&suite=testing&arch=amd64