SFML community forums

Help => General => Topic started by: guglielmo.boi on April 24, 2019, 12:24:36 pm

Title: SFML linking libraries to CodeBlocks statically
Post by: guglielmo.boi 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?
Title: Re: SFML linking libraries to CodeBlocks statically
Post by: eXpl0it3r 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. ;)
Title: Re: SFML linking libraries to CodeBlocks statically
Post by: guglielmo.boi 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.
Title: Re: SFML linking libraries to CodeBlocks statically
Post by: eXpl0it3r 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 (https://dev.my-gate.net/2018/01/10/rule-of-thumb-linking-order/) for linking order is: If library X depends on library Y, then X must come before Y.

Title: Re: SFML linking libraries to CodeBlocks statically
Post by: guglielmo.boi 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 (https://dev.my-gate.net/2018/01/10/rule-of-thumb-linking-order/) for linking order is: If library X depends on library Y, then X must come before Y.

It worked, thank you  :D