LWXGL ships as a single shared object —Documentation Index
Fetch the complete documentation index at: https://mintlify.com/dressedalarm184/lwxgl/llms.txt
Use this file to discover all available pages before exploring further.
libLWXGL.so — built directly from source with a one-line g++ invocation wrapped in a Makefile. There are no pre-built binaries; you compile it on your own machine and install it system-wide so that any project on the same machine can link against -lLWXGL. The build produces a position-independent shared library with hidden visibility by default, meaning only the functions explicitly tagged with __attribute__((visibility("default"))) are part of the public ABI.
Prerequisites
Before building, make sure the following are available on your system:- GCC / G++ with C++11 support — the library source uses
<chrono>,<thread>,<vector>, and other C++11 standard library features. Any GCC version shipped with a modern Linux distribution (GCC 5 or later) works. - libX11 development headers — required at compile time. On Debian/Ubuntu:
sudo apt install libx11-dev. On Fedora/RHEL:sudo dnf install libX11-devel. - The
9x15bitmap font — loaded at runtime when a window is opened. On Debian/Ubuntu it is provided by thexfonts-basepackage:sudo apt install xfonts-base. Without this fontGCreateWindowwill return error code2and refuse to open a window.
Build
Clone the repository and runmake build:
make build target runs the following command:
| Flag | Purpose |
|---|---|
-fPIC | Generate position-independent code required for shared libraries. |
-shared | Produce a shared object rather than an executable. |
-O2 | Enable standard optimisations. |
-lX11 | Link against the Xlib runtime. |
-fvisibility=hidden | Hide all symbols by default; only functions marked EXPORT (__attribute__((visibility("default")))) are visible to consumers. |
libLWXGL.so appears in the repository root.
Install
make install target performs the following three steps:
- Copies
libLWXGL.soto/usr/local/lib. - Copies
src/libLWXGL.hto/usr/local/include. - Runs
ldconfigto refresh the dynamic linker cache so the new library is found by name (-lLWXGL) at link time and at runtime.
Linking Your Project
Once the library is installed, compile any C program against it by passing-lLWXGL -lX11 to GCC:
libLWXGL.h wraps all declarations in an extern "C" block, making the library callable from either language without name-mangling issues.