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 is distributed as source code and built locally with make. There are no pre-built binaries — the build process compiles a single shared object (libLWXGL.so) from the library’s C++ sources and installs it alongside its public header so any project on your system can link against -lLWXGL.

Prerequisites

You need three things before building:
  • g++ — the GNU C++ compiler (the Makefile invokes g++ directly)
  • X11 development headers — Xlib headers and the libX11 shared library
  • make — GNU Make to run the build targets
On Debian, Ubuntu, and derivatives, install everything in one command:
sudo apt install g++ libx11-dev make
On Arch Linux:
sudo pacman -S gcc libx11 make
On Fedora / RHEL:
sudo dnf install gcc-c++ libX11-devel make

Build and Install

1

Clone the repository

Fetch the source from GitHub and enter the project directory:
git clone https://github.com/dRessedAlarm184/LWXGL.git && cd LWXGL
2

Build the shared library

Compile libLWXGL.so from source:
make build
This runs the following command internally:
build:
    g++ -fPIC -shared -O2 -o libLWXGL.so src/main.cc -lX11 -fvisibility=hidden
On success you will see libLWXGL.so appear in the project root. The -fvisibility=hidden flag ensures only symbols explicitly marked EXPORT are exposed in the shared object’s symbol table.
3

Install system-wide

Copy the library and header to the standard system locations and refresh the dynamic linker cache:
make install
This runs:
install:
    sudo cp libLWXGL.so /usr/local/lib
    sudo cp src/libLWXGL.h /usr/local/include
    sudo ldconfig
After this step, libLWXGL.so is available in /usr/local/lib and libLWXGL.h is available in /usr/local/include, so any compiler invocation with -lLWXGL and -I/usr/local/include (or the default include path) will find them.

Compiling Your Program

Once LWXGL is installed, link against it with -lLWXGL. No additional include path flags are needed because the header is placed in /usr/local/include, which is on the default search path for both gcc and g++. C project:
gcc -o myapp myapp.c -lLWXGL
C++ project:
g++ -o myapp myapp.cpp -lLWXGL
libLWXGL.h wraps all its declarations in extern "C" { ... } guards, so the exact same header works from both C and C++ without name-mangling conflicts. You do not need a separate C++ wrapper.
If your program compiles but fails at runtime with an error like error while loading shared libraries: libLWXGL.so: cannot open shared object file, the dynamic linker cannot find the library. Fix it by re-running sudo ldconfig after install, or temporarily set the search path for your session:
export LD_LIBRARY_PATH=/usr/local/lib

Build docs developers (and LLMs) love