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

Author Topic: Problem with static linking libraries (Win/C::B)  (Read 3940 times)

0 Members and 1 Guest are viewing this topic.

Kikert

  • Newbie
  • *
  • Posts: 4
    • View Profile
Problem with static linking libraries (Win/C::B)
« on: February 15, 2014, 07:52:25 pm »
Hi,
I'm trying to debug SFML 2.1 demo application from this setting Code::Blocks tutorial. I have Windows 7 64-bit with Code::Blocks 32-bit (MinGW).

As written, I created new project (and copied whole SFML-2.1 directory inside) with the following settings (Project/Build options...):

General:
Compiler settings/#defines: SFML_STATIC
Search directories/Compiler: SFML-2.1\include
Search directories/Linker: SFML-2.1\lib

Debug:
Linker settings/Link libraries:
libsfml-graphics-s-d
libsfml-system-s-d
libsfml-window-s-d

Release:
Linker settings/Link libraries:
libsfml-graphics-s
libsfml-system-s
libsfml-window-s

When I start debugging session everything builds fine, but there's error on startup like "Could not execute program because sfml-graphics-2.dll was not found." (in my native language).

I followed tutorial well and I have no idea what is done wrong. Any hints?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: Problem with static linking libraries (Win/C::B)
« Reply #1 on: February 15, 2014, 08:27:59 pm »
Are you sure, you're starting the right application? Because if you link everything as described it should not ask for a DLL...
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Kikert

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Problem with static linking libraries (Win/C::B)
« Reply #2 on: February 15, 2014, 09:00:52 pm »
Well, then I was, but now after full rebuild I have two errors repeating in sources:

SFML-2.1\lib\libsfml-graphics-s-d.a(CircleShape.cpp.obj)||In function `ZN2sf11CircleShapeC2Efj':|
D:\developpement\sfml\sfml\src\SFML\Graphics\CircleShape.cpp|37|undefined reference to `_Unwind_Resume'|
SFML-2.1\lib\libsfml-graphics-s-d.a(CircleShape.cpp.obj):CircleShape.cpp:(.eh_frame+0x13)||undefined reference to `__gxx_personality_v0'|

// ...

||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings (0 minutes, 2 seconds) ===|
 

Sometime both of them appears, sometimes it's only one of them.

Barlog

  • Guest
Re: Problem with static linking libraries (Win/C::B)
« Reply #3 on: February 15, 2014, 09:16:06 pm »
Hello.

Probably it's because you are using gcc not g++.
Try to add "-lstdc++" to end of compiler command line and rebuild again.

gcc test.cpp -lstdc++

(read this link or this on stackoverflow for more info)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: Problem with static linking libraries (Win/C::B)
« Reply #4 on: February 15, 2014, 11:22:30 pm »
It's more likely that you didn't make a clean rebuild and have some old object files from a different compiler version.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Kikert

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Problem with static linking libraries (Win/C::B)
« Reply #5 on: February 15, 2014, 11:53:39 pm »
I checked lstdc++ and there's no difference.

Also manual removing generated files and rebuild did not help.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
AW: Problem with static linking libraries (Win/C::B)
« Reply #6 on: February 16, 2014, 12:14:24 am »
Well have you built the libraries and your application with the exact same compiler?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Kikert

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Problem with static linking libraries (Win/C::B)
« Reply #7 on: February 16, 2014, 01:13:18 pm »
Didn't get it at first, sorry.

I've compiled static libraries for MinGW following tutorial, but now it seems like window cannot find dependencies:
||=== Firmy, Release ===|
SFML-2.1\lib\libsfml-window-s.a(Window.cpp.obj):Window.cpp|| undefined reference to `sf::Clock::restart()'|
SFML-2.1\lib\libsfml-window-s.a(Window.cpp.obj):Window.cpp|| undefined reference to `sf::err()'|
SFML-2.1\lib\libsfml-window-s.a(Window.cpp.obj):Window.cpp|| undefined reference to `sf::err()'|
SFML-2.1\lib\libsfml-window-s.a(Window.cpp.obj):Window.cpp|| undefined reference to `sf::Clock::Clock()'|
SFML-2.1\lib\libsfml-window-s.a(Window.cpp.obj):Window.cpp|| undefined reference to `sf::Time::Zero'|
SFML-2.1\lib\libsfml-window-s.a(Window.cpp.obj):Window.cpp|| undefined reference to `sf::Time::Zero'|
SFML-2.1\lib\libsfml-window-s.a(Window.cpp.obj):Window.cpp|| undefined reference to `sf::Clock::Clock()'|
SFML-2.1\lib\libsfml-window-s.a(Window.cpp.obj):Window.cpp|| undefined reference to `sf::Time::Zero'|
SFML-2.1\lib\libsfml-window-s.a(Window.cpp.obj):Window.cpp|| undefined reference to `sf::Time::Zero'|
SFML-2.1\lib\libsfml-window-s.a(Window.cpp.obj):Window.cpp|| undefined reference to `sf::err()'|

// ...

||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings (0 minutes, 2 seconds) ===|
 

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
AW: Problem with static linking libraries (Win/C::B)
« Reply #8 on: February 16, 2014, 02:27:54 pm »
You don't link against the system module properly. Make sure the order is correct as well.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

amir ramezani

  • Jr. Member
  • **
  • Posts: 81
  • i'm a programmer who can't see well
    • View Profile
    • download useful software!
    • Email
Re: Problem with static linking libraries (Win/C::B)
« Reply #9 on: February 17, 2014, 03:45:43 pm »
add these commands in the linker flags:
Code: [Select]
-static-libgcc
-static-libstdc++
and link the libraries like this:
Code: [Select]
sfml-audio-s
sfml-network-s
sfml-graphics-s
sfml-window-s
sfml-system-s
follow that for debug with -D at the end
and of course, link opengl32 and glu32 in order for it to work
if you can't see well, you can't test your applications and operating system well
my game engine:
allegro game creator
my operating system:
AmirOS

 

anything