Building LWXGL from source produces two artefacts that are copied to standard system locations: the shared libraryDocumentation 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.
/usr/local/lib/libLWXGL.so and the public header /usr/local/include/libLWXGL.h. Once installed, any C or C++ program on the same machine can include the header and link against the library with -lLWXGL.
Prerequisites
You need a C++ compiler and the X11 development headers. LWXGL’sMakefile invokes g++ directly.
Debian / Ubuntu:
libX11 (-lX11), which ships with libx11-dev / libX11-devel.
Build and Install
Build the shared library
Run the This executes the following compiler invocation exactly as written in the Flags explained:
After a successful build you will see
build Make target to compile libLWXGL.so into the repository root:Makefile:| Flag | Purpose |
|---|---|
-fPIC | Position-independent code, required for shared libraries |
-shared | Produce a shared object rather than an executable |
-O2 | Standard optimisation level |
-lX11 | Link against the system Xlib |
-fvisibility=hidden | Hide all symbols by default; only functions marked __attribute__((visibility("default"))) are exported |
libLWXGL.so in the current directory.Compiling Your Program
After installation, link your program against LWXGL with-lLWXGL. No -I or -L flags are needed because the header and library are in the standard search paths.
With gcc (for C programs):
g++ (for C++ programs):
Manual Installation (No sudo)
If you do not have root access you can install LWXGL into a user-local prefix instead.LD_LIBRARY_PATH before running your program so the dynamic linker resolves libLWXGL.so at runtime:
export line to your ~/.bashrc or ~/.profile to make the setting permanent.