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

Author Topic: SFML linking libraries to CodeBlocks statically  (Read 1443 times)

0 Members and 1 Guest are viewing this topic.

guglielmo.boi

  • Newbie
  • *
  • Posts: 3
    • View Profile
SFML linking libraries to CodeBlocks statically
« on: April 24, 2019, 12:24:36 pm »
Hi, I tried to link the sfml libraries statically to codeblocks following the tutorial; it all went perfect, all the libraries worked. Then, after closing and rebulding the project, I noticed codeblocks deleted the linking to the Dependencies that appeared two or more times. Such as 'sfml-system-s'.
How can I solve this problem?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: SFML linking libraries to CodeBlocks statically
« Reply #1 on: April 24, 2019, 12:38:26 pm »
Code::Blocks actually helped you, because you should only ever link once to a library, otherwise you'd end up with multiple definitions of the same symbols. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

guglielmo.boi

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SFML linking libraries to CodeBlocks statically
« Reply #2 on: April 24, 2019, 01:03:23 pm »
Code::Blocks actually helped you, because you should only ever link once to a library, otherwise you'd end up with multiple definitions of the same symbols. ;)
Well, the problem is sfml works only in the first case, while in the second case it gives me some problems about the audio library, which seem non correctly linked.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: SFML linking libraries to CodeBlocks statically
« Reply #3 on: April 24, 2019, 01:08:45 pm »
Ah, that's because sfml-system-s needs to be after the other SFML libraries, as all SFML libraries depend on sfml-system. That's also why it's listed for every library in the tutorial. You should only copy a library once from that list, but keep the relative order as in the list.

The rule of thumb for linking order is: If library X depends on library Y, then X must come before Y.

Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

guglielmo.boi

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SFML linking libraries to CodeBlocks statically
« Reply #4 on: April 24, 2019, 02:56:41 pm »
Ah, that's because sfml-system-s needs to be after the other SFML libraries, as all SFML libraries depend on sfml-system. That's also why it's listed for every library in the tutorial. You should only copy a library once from that list, but keep the relative order as in the list.

The rule of thumb for linking order is: If library X depends on library Y, then X must come before Y.

It worked, thank you  :D

 

anything