Skip to main content

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.

LWXGL has no package manager release — you build it directly from source using a single make command. The build produces one file (libLWXGL.so) and make install places it where the system linker can find it. The entire process takes under a minute on any modern machine.

Prerequisites

You need three things before building:
  • g++ — any version that supports C++17 (-std=gnu++17). GCC 7 or later is sufficient; GCC 9+ is recommended.
  • libx11-dev — the Xlib development headers and import library. The package name differs by distribution (see below).
  • make — GNU Make is used to drive the build.
Install the prerequisites for your distribution:
sudo apt install build-essential libx11-dev
build-essential (Debian/Ubuntu) or base-devel (Arch) already includes both g++ and make. On Fedora you may need to install make separately if it is not already present.

Install steps

1

Clone the repository

Download the LWXGL source to your machine:
git clone https://github.com/DRESsedAlarm184/LWXGL.git
cd LWXGL
2

Build the shared library

Run make from the repository root. This compiles src/main.cc and produces libLWXGL.so in the current directory:
make
The full compiler invocation that runs is:
g++ -std=gnu++17 -D_GNU_SOURCE -fPIC -shared -O2 -o libLWXGL.so src/main.cc -lX11 -fvisibility=hidden
All internal symbols are hidden by -fvisibility=hidden; only the functions declared in libLWXGL.h are exported.
You can override the optimization level with the O variable. For a faster binary use make O=3; for a debug build use make O=0:
make O=3
The default is O=2 (-O2).
3

Install system-wide

Copy the library and header to the standard system locations and refresh the linker cache:
sudo make install
This runs:
cp libLWXGL.so /usr/local/lib
cp src/libLWXGL.h /usr/local/include
ldconfig
After ldconfig completes, libLWXGL.so is discoverable by the dynamic linker on any future program launch.
4

Verify the installation

Confirm the library is registered with the linker:
ldconfig -p | grep LWXGL
You should see a line like:
libLWXGL.so (libc6,x86-64) => /usr/local/lib/libLWXGL.so

Linking your application

Once installed, include the header and link with -lLWXGL:
#include <libLWXGL.h>
gcc -o myapp myapp.c -lLWXGL
You do not need to pass -lX11 explicitly; LWXGL’s shared object already carries that dependency.
If you skip make install and want to run a binary against a locally built libLWXGL.so, you must tell the dynamic linker where to find it at runtime:
LD_LIBRARY_PATH=/path/to/LWXGL ./myapp
This is only needed when the library has not been installed to /usr/local/lib and ldconfig has not been run.

Uninstalling

Remove the installed files manually:
sudo rm /usr/local/lib/libLWXGL.so /usr/local/include/libLWXGL.h
sudo ldconfig

Build docs developers (and LLMs) love