Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Why does this link chain not work (SFML static link)  (Read 3450 times)

0 Members and 1 Guest are viewing this topic.

Gamaray

  • Newbie
  • *
  • Posts: 6
    • View Profile
Why does this link chain not work (SFML static link)
« on: October 22, 2022, 02:50:51 pm »
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



kojack

  • Sr. Member
  • ****
  • Posts: 344
  • C++/C# game dev teacher.
    • View Profile
Re: Why does this link chain not work (SFML static link)
« Reply #1 on: October 22, 2022, 05:49:17 pm »
You missed a -lopenal32

Gamaray

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Why does this link chain not work (SFML static link)
« Reply #2 on: October 22, 2022, 07:49:46 pm »
Ah thank you!
Still the same issue however.
Though this time the error is shorter and only talks about graphics and audio.
« Last Edit: October 22, 2022, 07:51:37 pm by Gamaray »

 

anything