ClanLib is a free, open-source C++ toolkit for making games, with modules for 2D graphics, input, sound, networking and user interfaces. It has been around since the late 1990s, it’s released under the permissive zlib licence, and it’s still maintained in 2026 by a small team. It’s not a full engine with an editor: it’s a code library you build your game on, in modern C++.
This profile covers what ClanLib is, what its current modules do, how much it changed between versions 3 and 4, a minimal working example, the games built with it, and which libraries to consider instead. Versions and dates were checked against the ClanLib repository in October 2026, and the example was compiled and run against ClanLib 4.2.0.
What Is ClanLib?
ClanLib is an open-source, cross-platform C++ game SDK released under the zlib licence. It provides 2D graphics through OpenGL and Direct3D render targets, plus input, sound, networking, user-interface and XML modules, on Windows, Linux and macOS. The latest release is 4.2.0 (August 2024), which requires C++20, and the project is still maintained in 2026.
ClanLib at a glance
| Type | Open-source C++ game SDK (code library, no editor) |
|---|---|
| Developers | The ClanLib Team, led by Magnus Norddahl, Mark Page and Kenneth Gangstoe |
| First public release | 0.1.18, 1999 (copyright from 1997) |
| Latest release | 4.2.0, August 2024; fixes continuing in 2026 |
| Language | C++ (C++20 required since 4.2) |
| Licence | zlib-style: free for any use, including commercial |
| Render targets | OpenGL 4.3 (with an OpenGL 1 fallback) and Direct3D on Windows |
| Modules | Core, App, Display, GL, D3D, Sound, Network, UI, XML |
| Runs on | Windows, Linux and macOS; partial mobile support |
| Known games | Pingus (until 2007) and ClanBomber |
A Short History of ClanLib
ClanLib’s earliest known public release, version 0.1.18, dates from 1999, and its copyright notice runs from 1997. It became one of the better-known open-source C++ game libraries of the early 2000s, used by Linux games such as Pingus and ClanBomber. Magnus Norddahl, Mark Page and Kenneth Gangstoe head its list of developers.
The project has been through several major rewrites:
- ClanLib 3.0 (September 2013) was a large SDK with 17 modules, including a GUI system, a software renderer, SQLite database support, physics and a 3D scene module.
- ClanLib 4.0 (May 2015) cut that back to a focused core, removing ten modules and replacing the GUI with a new UI module.
- ClanLib 4.1 (March 2021) and 4.2 (August 2024) modernised the code further. Version 4.2 moved to C++20, raised the main OpenGL target to OpenGL 4.3, switched Windows support to Visual Studio 2022, and added fullscreen switching on Linux.
Work continued after 4.2: the repository received fixes through 2025 and into April 2026, mostly from long-time developer Mark Page (ClanLib on GitHub).
What’s in ClanLib 4.2
ClanLib 4.2 is split into nine libraries, and you link only the ones you need:
| Module | What it does |
|---|---|
| clanCore | Strings, maths, files, threading, JSON and other basics every module uses |
| clanApp | The application entry point and main loop |
| clanDisplay | Windows, input (keyboard, mouse, joystick), 2D drawing with the Canvas class, images, sprites and fonts |
| clanGL / clanD3D | Render targets: OpenGL 4.3 (with an OpenGL 1 fallback) on all platforms, and Direct3D on Windows |
| clanSound | WAV and Ogg Vorbis playback |
| clanNetwork | Sockets and higher-level game networking interfaces |
| clanUI | User interfaces with Flexbox positioning and CSS-style layouts |
| clanXML | XML parsing and XML-based resource management |
It also includes a template-based signal library for type-safe callbacks, which ClanLib uses for events such as window closing and key presses. On Windows, the Microsoft build needs no extra support libraries. Mobile platforms have only partial support.
Hello, ClanLib: A Minimal Example
The program below opens a window, draws a line of text and a green square that bounces up and down, and quits when you close the window or press Escape. ClanLib 4 programs are classes derived from clan::Application, whose update() method runs once per frame.
// hello_clanlib.cpp - a window with text and a bouncing square (ClanLib 4.2)
#include <ClanLib/core.h>
#include <ClanLib/application.h>
#include <ClanLib/display.h>
#include <ClanLib/gl.h>
#include <cmath>
class HelloClanLib : public clan::Application
{
public:
HelloClanLib()
{
clan::OpenGLTarget::set_current(); // use the OpenGL render target
clan::DisplayWindowDescription desc;
desc.set_title("Hello, ClanLib");
desc.set_size(clan::Sizef(640.0f, 480.0f), true);
window = clan::DisplayWindow(desc);
canvas = clan::Canvas(window);
font = clan::Font("DejaVu Sans", 28);
// Quit when the window is closed or Escape is pressed
sc.connect(window.sig_window_close(), [this]() { quit = true; });
sc.connect(window.get_keyboard().sig_key_up(),
[this](const clan::InputEvent &key) {
if (key.id == clan::keycode_escape) quit = true;
});
game_time.reset();
}
// Called once per frame; return false to exit
bool update() override
{
game_time.update();
float t = game_time.get_current_time();
canvas.clear(clan::Colorf(0.10f, 0.44f, 0.83f)); // blue background
font.draw_text(canvas, 24.0f, 48.0f, "Hello, ClanLib!",
clan::Colorf::white);
float y = 240.0f + std::sin(t * 3.0f) * 120.0f; // bounce up and down
canvas.fill_rect(clan::Rectf(290.0f, y - 30.0f, clan::Sizef(60.0f, 60.0f)),
clan::Colorf(0.27f, 0.50f, 0.25f));
window.flip(1); // show the frame, synced to the display
return !quit;
}
private:
bool quit = false;
clan::SlotContainer sc;
clan::DisplayWindow window;
clan::Canvas canvas;
clan::Font font;
clan::GameTime game_time;
};
clan::ApplicationInstance<HelloClanLib> clanapp;
ClanLib doesn’t provide Linux binaries, so you build it from source first. On Ubuntu or Debian:
sudo apt install make g++ automake libtool pkg-config libfreetype6-dev \
libfontconfig1-dev libgl1-mesa-dev libxrender-dev libasound2-dev libxinerama-dev
git clone https://github.com/sphair/ClanLib.git && cd ClanLib
./autogen.sh && ./configure && make -j$(nproc) && sudo make install
g++ -std=c++20 hello_clanlib.cpp -o hello_clanlib \
$(pkg-config --cflags --libs clanCore-4.2 clanApp-4.2 clanDisplay-4.2 clanGL-4.2)
./hello_clanlib
We compiled and ran this example against ClanLib 4.2.0, built from source with GCC 13 on Ubuntu 24.04, using Mesa’s software OpenGL 4.5 driver. It compiled with no warnings from the example code (-Wall) and rendered the window shown below.

Games Built with ClanLib
| Game | How it used ClanLib |
|---|---|
| Pingus | Ingo Ruhnke’s open-source Lemmings-style puzzle game was built on ClanLib until a port to SDL began in 2006. Version 0.7.0 (August 2007) was the first SDL release (Wikipedia’s Pingus article) |
| ClanBomber | A GPL Bomberman-style multiplayer game for up to eight players, named after the library it was built on. Its modern ClanBomber2 fork has since been ported to SDL (ClanBomber2 on GitHub) |
Pingus moved to SDL in 2007, and the maintained ClanBomber2 fork has too. That says less about ClanLib’s quality than about its size: SDL has a far larger community and more platform support, which matters for projects maintained over decades.
Is ClanLib Still Maintained in 2026?
Yes, but by a very small team. ClanLib 4.2.0 is the latest release (August 2024), and the repository received fixes through 2025 and in April 2026, including X11 fullscreen fixes for Linux. There’s no announced date for a next release.
That makes ClanLib a reasonable choice for:
- Learning game programming in modern C++, with a readable, object-oriented API and many example programs (2D, 3D, display, input, network, sound and UI).
- Small 2D games and tools on Windows and Linux, where the zlib licence lets you ship commercially with no fees or source disclosure.
It’s a weaker choice if you need mobile or console support, a visual editor, or a large community to answer questions.
ClanLib Alternatives
- SDL: one of the most widely used C libraries for windows, input, audio and graphics in games, and the library both Pingus and ClanBomber2 moved to. It’s zlib-licensed like ClanLib (SDL’s website).
- SFML: a C++ multimedia library with a similarly object-oriented, beginner-friendly API for graphics, audio and networking (SFML’s website).
- Irrlicht: an open-source C++ 3D engine from the same era, still maintained. See our Irrlicht engine profile.
- Godot: a full engine with an editor, if you’d rather not build your game framework yourself. See our Godot engine profile.
For more libraries and engines, see our directory of open-source C++ game engines.
Key Takeaways
- ClanLib is an open-source C++ game SDK under the zlib licence, free for commercial use, with roots going back to the late 1990s.
- Version 4.2.0 (August 2024) is the latest, requiring C++20 and OpenGL 4.3, with fixes continuing into 2026.
- ClanLib 4 is much smaller than ClanLib 3: the software renderer, SQLite, physics and the old GUI were removed in 4.0, and a new Flexbox/CSS UI module took the GUI’s place.
- It covers 2D graphics, input, sound, networking, UI and XML on Windows, Linux and macOS, with OpenGL and Direct3D render targets.
- A working window takes under 70 lines of C++, but you build the library from source on Linux.
- Its best-known games, Pingus and the ClanBomber2 fork later moved to SDL, which, along with SFML, is the main alternative.
Conclusion
ClanLib is one of the longest-running open-source C++ game libraries, and it has survived by shrinking rather than growing: ClanLib 4 traded breadth for a smaller, modern C++ core. It won’t replace a full engine or SDL’s reach, but for learning and for small C++ games, it’s still a clean, permissively licensed toolkit that its developers keep updating.
For more engines across every genre, browse our game development hub.




