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

Author Topic: Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)  (Read 3992 times)

0 Members and 1 Guest are viewing this topic.

airbournenation

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« on: November 21, 2016, 05:48:37 pm »
Hi,
whenever I try to compile any of the sample codes, the same type of error occurs. Here's the build log:

(click to show/hide)


And the code:
(click to show/hide)


SFML_STATIC is defined.


Linker/compiler dirs are defined correctly.


A few hours on Google yielded no results.

I use the MinGW version of SFML. Doesn't matter, whether it's 32/64 bit, either one produces the same errors.
My computer runs on Windows 7 SP1 64 bit.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« Reply #1 on: November 21, 2016, 06:07:41 pm »
You're linking both release and debug SFML libraries against your code. Make sure to only link release libraries in release mode and debug libraries in debug mode.

One source of mistake may be, that you added SFML libraries in the project wide settings.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

airbournenation

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« Reply #2 on: November 23, 2016, 05:11:42 pm »
Thank you for your fast reply! Yes, I did the linking globally project-wise, as opposed to linking Debug and Release versions separately. Sadly, this did not change anything :(.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« Reply #3 on: November 23, 2016, 05:47:06 pm »
Make sure to do a full rebuild after you removed the global settings. Also provide the full error and full build command.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

airbournenation

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« Reply #4 on: November 23, 2016, 05:52:11 pm »
Build log:

(click to show/hide)

Where can I find the build command?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« Reply #5 on: November 23, 2016, 07:52:32 pm »

mingw32-g++.exe -LC:\CodeBlocks\SFML\lib -LC:\CodeBlocks\SFML\lib -LC:\CodeBlocks\SFML\lib -o bin\Debug\SFML.exe obj\Debug\main.o   -lsfml-graphics-s-d -lfreetype -ljpeg -ldxguid -lsfml-window-s-d -lopengl32 -lgdi32 -lmingw32 -lsfml-system-s-d -lwinmm -luser32 -lsfml-audio-s-d -lsfml-network-s-d -lopenal32 -lws2_32 -lsfml-graphics-s -lfreetype -ljpeg -lsfml-window-s -lopengl32 -lgdi32 -lsfml-system-s -lwinmm
You are still linking release and debug libraries.

If you can't find the settings, try to start a new project.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

airbournenation

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« Reply #6 on: November 24, 2016, 01:44:36 pm »
What? I double checked it to prevent things like that from happening! Seems like your suggestion is the only viable option in this mess.

airbournenation

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« Reply #7 on: November 28, 2016, 05:21:37 pm »
So, I've tried to make a new project with the same settings but without the mistakes you've mentioned before. No luck.

Build log:
(click to show/hide)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« Reply #8 on: November 28, 2016, 05:26:55 pm »
Try again... ;)

Quote
-lsfml-graphics-s-d -lfreetype -ljpeg -ldxguid -lsfml-window-s-d -lopengl32 -lgdi32 -lmingw32 -lsfml-system-s-d -lwinmm -luser32 -lsfml-graphics-s -lfreetype -ljpeg -lsfml-window-s -lopengl32 -lgdi32 -lsfml-system-s -lwinmm
Laurent Gomila - SFML developer

airbournenation

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« Reply #9 on: November 28, 2016, 05:35:14 pm »
What the f***, Code::Blocks? Why is it linking libraries from both Debug and Release?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« Reply #10 on: November 28, 2016, 05:50:21 pm »
Copy-paste the content of your project file here (it's XML, easily readable) and we'll tell you what's wrong.
Laurent Gomila - SFML developer

airbournenation

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« Reply #11 on: November 28, 2016, 05:53:13 pm »
Thanks for your fast response! Here it is:

(click to show/hide)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« Reply #12 on: November 28, 2016, 06:03:10 pm »
You're not linking anything in your project. Are you certain that you didn't add the libraries to the global compiler settings?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

airbournenation

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« Reply #13 on: November 28, 2016, 06:04:16 pm »
Yes. I'm absolutely sure. Double check made me even more sure of myself :).

jamesL

  • Full Member
  • ***
  • Posts: 124
    • View Profile
Re: Linking problems with Code::Blocks 13.12 (SFML version 2.4.1)
« Reply #14 on: November 28, 2016, 06:13:10 pm »
should look something like this

(click to show/hide)

and read this again
http://www.sfml-dev.org/tutorials/2.4/start-cb.php