SFML community forums

Help => General => Topic started by: Qwdfg on March 19, 2018, 09:53:14 pm

Title: SFML does not work in CodeBlocks
Post by: Qwdfg on March 19, 2018, 09:53:14 pm
Following https://www.sfml-dev.org/tutorials/2.4/compile-with-cmake.php (https://www.sfml-dev.org/tutorials/2.4/compile-with-cmake.php)

Path = C:\Program Files (x86)\CodeBlocks\MinGW\bin

Cmake config:
https://imgur.com/a/vSyiR (https://imgur.com/a/vSyiR)
https://imgur.com/a/t8Gmy (https://imgur.com/a/t8Gmy)

Some strange mistake appeared, but the libraries are compiled:
https://imgur.com/a/zIaXM (https://imgur.com/a/zIaXM)

Try to compile program:
https://imgur.com/a/wtfmN (https://imgur.com/a/wtfmN)
And got an error:
https://imgur.com/a/TUquh (https://imgur.com/a/TUquh)

What have I done wrong ?
Title: Re: SFML does not work in CodeBlocks
Post by: eXpl0it3r on March 20, 2018, 12:41:41 am
You didn't link ws2_32 as mentioned in the tutorial.
Title: Re: SFML does not work in CodeBlocks
Post by: Qwdfg on March 20, 2018, 01:13:12 am
You didn't link ws2_32 as mentioned in the tutorial.
I don't find any mentioned in the tutorial about linking ws2_32.I tried to compile sf::RenderWindow, but:
https://imgur.com/a/VslIB (https://imgur.com/a/VslIB)
I can't understand where my error  :'(
Title: Re: SFML does not work in CodeBlocks
Post by: eXpl0it3r on March 20, 2018, 01:18:16 am
Check the Code::Blocks tutorial: https://www.sfml-dev.org/tutorials/2.4/start-cb.php
Title: Re: SFML does not work in CodeBlocks
Post by: Qwdfg on March 20, 2018, 10:53:30 am
Check the Code::Blocks tutorial: https://www.sfml-dev.org/tutorials/2.4/start-cb.php
I read it.
Quote
Additionally, because Code::Blocks makes use of GCC, the linking order does matter. This means that libraries that depend on other libraries have to be added to the library list before the libraries they depend on

My linker settings:
https://imgur.com/a/RjDvA (https://imgur.com/a/RjDvA)

sfml-system has dependency winmm
sfml-network has dependency ws2_32 and sfml-system

But it does not work  :(
Title: Re: SFML does not work in CodeBlocks
Post by: eXpl0it3r on March 20, 2018, 11:14:19 am
As mentioned in the tutorial, link order matters. You've put ws2_32 before the sfml-network module, but sfml-network depends on ws2_32, thus it must come first.
Title: Re: SFML does not work in CodeBlocks
Post by: Qwdfg on March 20, 2018, 12:08:15 pm
As mentioned in the tutorial, link order matters. You've put ws2_32 before the sfml-network module, but sfml-network depends on ws2_32, thus it must come first.
It looks like i misunderstood tutorial. All works fine ! Thank you  ;)