I'm having issues statically linking a program on windows 10.
I have built SFML with cmake and now need to statically compile my code.
To do this I am using a Makefile that looks like this:
all:
g++ main.cpp -o wampus.exe -DSFML_STATIC -I C:\lib\SFML\include -L C:\lib\SFML\lib -lsfml-window-s -
lsfml-system-s -lopengl32 -lwinmm -lgdi32 -lsfml-graphics-s -lfreetype -lsfml-audio-s -lflac -lvorbisenc
-lvorbisfile -lvorbis -logg
When I run mingw32-make all, I get a pretty massive chain of errors, presumably because this link chain is not in the correct order. It there a way I can fix this?
Error snippet:
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\lib\SFML\lib/libsfml-audio-s.a(AudioDevice.cpp.obj):AudioDevice.cp:(.text$_ZNSt8auto_ptrIN2sf4priv11AudioDeviceEED1Ev[_ZNSt8auto_ptrIN2sf4priv11AudioDeviceEED1Ev]+0x11): undefined reference to `__imp_alcMakeContextCurrent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\lib\SFML\lib/libsfml-audio-s.a(AudioDevice.cpp.obj):AudioDevice.cp:(.text$_ZNSt8auto_ptrIN2sf4priv11AudioDeviceEED1Ev[_ZNSt8auto_ptrIN2sf4priv11AudioDeviceEED1Ev]+0x23): undefined reference to `__imp_alcDestroyContext'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\lib\SFML\lib/libsfml-audio-s.a(AudioDevice.cpp.obj):AudioDevice.cp:(.text$_ZNSt8auto_ptrIN2sf4priv11AudioDeviceEED1Ev[_ZNSt8auto_ptrIN2sf4priv11AudioDeviceEED1Ev]+0x35): undefined reference to `__imp_alcCloseDevice'
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [Makefile:2: all] Error 1