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

Author Topic: SFML does not work in CodeBlocks  (Read 1734 times)

0 Members and 1 Guest are viewing this topic.

Qwdfg

  • Newbie
  • *
  • Posts: 4
    • View Profile
SFML does not work in CodeBlocks
« on: March 19, 2018, 09:53:14 pm »
Following 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/t8Gmy

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

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

What have I done wrong ?
« Last Edit: March 19, 2018, 09:56:40 pm by Qwdfg »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML does not work in CodeBlocks
« Reply #1 on: March 20, 2018, 12:41:41 am »
You didn't link ws2_32 as mentioned in the tutorial.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Qwdfg

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: SFML does not work in CodeBlocks
« Reply #2 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
I can't understand where my error  :'(

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML does not work in CodeBlocks
« Reply #3 on: March 20, 2018, 01:18:16 am »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Qwdfg

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: SFML does not work in CodeBlocks
« Reply #4 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

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

But it does not work  :(

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML does not work in CodeBlocks
« Reply #5 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Qwdfg

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: SFML does not work in CodeBlocks
« Reply #6 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  ;)

 

anything