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

Author Topic: Problem with static linking SFML 2.5.1  (Read 1769 times)

0 Members and 1 Guest are viewing this topic.

Marfi

  • Newbie
  • *
  • Posts: 3
    • View Profile
Problem with static linking SFML 2.5.1
« on: June 06, 2020, 04:43:22 pm »
Hello to everyone.
I'm having issues when trying to static link.

I'm using this version of sfml 2.5.1  and
g++ --version
g++ (MinGW.org GCC-6.3.0-1) 6.3.0

if I try to compile with dynamic link everything is going fine
g++   -g main.cpp -I"e:\SFML-2.5.1\include" -o main.exe -L"e:\SFML-2.5.1\lib" -lsfml-graphics-d   -lsfml-window-d   -lsfml-system-d   -lopengl32 -lwinmm -lgdi32

but if I try to static link
g++ -DSFML_STATIC -g main.cpp -I"e:\SFML-2.5.1\include" -o main.exe -L"e:\SFML-2.5.1\lib" -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d -lopengl32 -lwinmm -lgdi32

I have got:
e:\SFML-2.5.1\lib/libsfml-system-s-d.a(Err.cpp.obj): In function `sync':
D:/Programming/C++/Releases/_Sources/SFML/src/SFML/System/Err.cpp:87: undefined reference to `_imp____acrt_iob_func'
collect2.exe: error: ld returned 1 exit status


Can anyone point me what I'm doing wrong?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: Problem with static linking SFML 2.5.1
« Reply #1 on: June 07, 2020, 12:36:54 am »
Did you build SFML yourself?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Marfi

  • Newbie
  • *
  • Posts: 3
    • View Profile

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: Problem with static linking SFML 2.5.1
« Reply #3 on: June 07, 2020, 05:41:38 pm »
Well the big red box on the download page isn't just for decoration ;)

Quote
The compiler versions have to match 100%!
Here are links to the specific MinGW compiler versions used to build the provided packages:

Your compiler version and the downloaded pre-built SFML version are not compatible.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Marfi

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Problem with static linking SFML 2.5.1
« Reply #4 on: June 07, 2020, 06:25:58 pm »
Oh my gosh! I'm so ashamed. Thx for your time ;)

 

anything