# C++ Modules Usage & Examples
## Introduction
Xmake uses `.mpp` as the default module extension, but also supports `.ixx`, `.cppm`, `.mxx`, etc. It fully supports C++20 Modules with gcc11/clang/msvc, and can automatically analyze module dependencies for maximum parallel compilation.
## Basic Example
## Class Example
Exporting classes in modules:
## Module Partitions
Using module partitions:
## Shared Library Modules
Creating a shared library with modules:
## Cross-Target Dependency
Modules dependency between targets:
## Private Module Fragment
Using private module fragment to hide implementation details:
## Module Implementation Unit
Separating module interface and implementation:
## Module Aggregation
Using `export import` to aggregate submodules:
## Cpp-only Project with Modules
From v2.7.1, Headerunits are supported. Normally, at least one `.mpp` file is needed to enable modules, but you can also force it:
## Headerunits Example
See [headerunits example](https://github.com/xmake-io/xmake/tree/dev/tests/projects/c%2B%2B/modules/headerunits) for how to use STL or custom headers as headerunits.
## C++23 Standard Library Modules
Support for C++23 stdmodules:
## Module Package Distribution
Define and distribute a C++ Modules package:
## Module Package Integration
Quickly integrate with `add_requires("foo")`:
> More official examples: [C++ Modules Examples](https://github.com/xmake-io/xmake/tree/dev/tests/projects/c%2B%2B/modules)