Reputation: 3
I recently developed a small SDL2 game. The game ran fine on my computer because I have SDL, SDL_image, SDL_mixer, and SDL_ttf installed. However, everyone who downloaded the game did not have SDL2 and the extensions installed, so they could not run the application. How can I make the application usable even for people who don't have SDL2 installed?
Upvotes: 0
Views: 513
Reputation: 1890
You could statically link you libs, that way no need to have SDL installed.
A way to do it :
g++ -o program [sources.cpp] -Wl,-Bstatic -lSDL2 -lSDL2_image \
-lSDL2_mixer -lSDL2_ttf -Wl,-Bdynamic [dynamically linked libs]
Note : If you use SDL2, you must use the SDL2 builds of peripheral libs otherwise you risk all kinds of errors.
Upvotes: 0
Reputation: 63114
You can pass the -rpath
option to ld to specify search directories for dynamic libraries.
Using -rpath .
(-Wl,-rpath .
to pass it from GCC) will enable loading the libraries from the executable's directory. Just put the appropriate .so
files there and they will be found.
Upvotes: 2