Hey,
I have created a small game in C++ with SFML on Linux and would like to share it with my friend who uses Windows. However when he tries to run the .exe it can't find some .dll files. When I compiled I didn't know the difference between doing it dynamically or statically. After having read up on it I thought I would use static linking instead to have SFML integrated into the executable to avoid this problem. The problem is I don't know how
To compile my game for Linux I use:
g++ ./src/*.cpp -o main -lsfml-graphics -lsfml-window -lsfml-system
and for Windows:
x86_64-w64-mingw32-g++ ./src/*.cpp -o main.exe -lsfml-graphics -lsfml-window -lsfml-system -mwindows
On the FAQ
https://www.sfml-dev.org/faq.php#build-link-static it says to link against the static libraries of SFML and add
SFML_STATIC to the preprocessor option. What I though this meant was to add -s to the end of the libraries and use -Xpreprocessor SFML_STATIC.
So I tried:
x86_64-w64-mingw32-g++ ./src/*.cpp -o main.exe -Xpreprocessor SFML_STATIC -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -mwindows
That didn't work.
I am new to C++ and to be honest I have no idea what I am doing. I saw some similar threads to this one but still couldn't figure out how to do this. Maybe I am just dumb and missing something obvious.
Any help would be greatly appreciated!