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

Author Topic: Can't link statically on Windows  (Read 1381 times)

0 Members and 1 Guest are viewing this topic.

Yenaled

  • Newbie
  • *
  • Posts: 6
    • View Profile
Can't link statically on Windows
« on: March 11, 2015, 10:34:05 am »
Hello everyone,

I am trying to do static linking. I have -DSFML_STATIC set, and for my libs, I am using: -static -lsfml-audio-s -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lsndfile -lopenal32 -ljpeg -lglew -lfreetype -lws2_32 -lgdi32 -lopengl32 -lwinmm (this should be the correct order and "-s" indicates static and those should be all the necessary dependencies).
I have my library path set as: -L"C:\\Users\\me\\Documents\\Programming\\SFML-build\\lib" as well as -L"C:\\Users\\me\\Documents\\Programming\\SFML\\extlibs\\libs-mingw\\x86" (for the external libraries)

Everything compiles just fine without errors.

However, when I run my executable, I get the following error: "The program can't start because sfml-audio-2.dll is missing from your computer." Why am I getting this error? I am linking statically so there shouldn't be a need for that DLL file...

(I am on Windows 8 and I compile from the command line without the use of an IDE; I'm using mingw32-g++ to compile. And yes, "libsfml-audio-s.a" definitely  exists in the SFML-build\lib directory.)

Edit: And yes, I have openal32.dll and libsndfile-1.dll in the same directory as my executable.
« Last Edit: March 11, 2015, 10:40:41 am by Yenaled »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Can't link statically on Windows
« Reply #1 on: March 11, 2015, 10:43:00 am »
Are you 100% certain you're actually running the freshly built application and not an older/different executable?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Yenaled

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Can't link statically on Windows
« Reply #2 on: March 11, 2015, 10:48:32 am »
I did a "make clean" (which deleted the executable and all object files and whatnot), rebuilt SFML, and rebuilt my project. Exact same error.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Can't link statically on Windows
« Reply #3 on: March 11, 2015, 10:53:22 am »
But when you do start the application, you start the application that got just built and not some old left over, right?

Application don't just suddenly link dynamically against stuff if you explicitly don't tell them to do so, as such there's some where an issue on your end. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Yenaled

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Can't link statically on Windows
« Reply #4 on: March 12, 2015, 01:43:37 am »
Thanks for your help! I got it to work somehow.   ;D It must've been some left over or something.

 

anything