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

Author Topic: Static linking help 2.0  (Read 1886 times)

0 Members and 1 Guest are viewing this topic.

big_totoro

  • Newbie
  • *
  • Posts: 11
    • View Profile
Static linking help 2.0
« on: November 07, 2012, 06:17:09 pm »
Hi everyone,

I'm new to SFML so I have been following the tutorials religiously! Got everything working with dynamic linking in 2.0 but the instructions for static linking don't seem to be working. Tried the debug version and release libraries but it keeps asking for the dll files in the bin folder. So I tried linking  to the bin folder and it works but the tutorial says you only need to link to the lib folder so I am bit confused.

Should I be linking to the lib folder or the bin folder or perhaps both?

Thanks in advance.

(Code::blocks, MinGW 4.4, Windows 7)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Static linking help 2.0
« Reply #1 on: November 07, 2012, 07:23:26 pm »
Quote
it keeps asking for the dll files in the bin folder
Which ones?

Can you upload your .cbp file?
Laurent Gomila - SFML developer

big_totoro

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Static linking help 2.0
« Reply #2 on: November 07, 2012, 09:32:04 pm »
It says: "This program can't start because 'sfml-window-2.dll' is missing from your computer.". But if I link to the bin folder (which contains that file) in the project's build options, under linker in the search directories, it works. But it doesn't say I need to do that in the tutorial so I don't know if it's what I should be doing, or just a workaround.

(The program is just a couple of bits from the tutorial pasted to test the keyboard event I was having trouble with in the previous version.)

[attachment deleted by admin]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Static linking help 2.0
« Reply #3 on: November 07, 2012, 10:02:45 pm »
You link to the debug static libraries in your global settings, and you also link to the release dynamic libraries in your debug settings. And nothing in your release settings.
Laurent Gomila - SFML developer

big_totoro

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Static linking help 2.0
« Reply #4 on: November 07, 2012, 10:32:24 pm »
Whoops, I didn't even notice the different debug and release options on the side. Just me being stupid then lol.   
But in my defense the tutorial isn't completely clear.

So now I've put the SFML_STATIC in the #defines section for global, debug and release. Is that right? Or should it just be global?
And I've also put the debug and release libraries in the right place in linker settings, but what do I put in the linker settings for global? The release libraries again?
Also, do I need to do the search directories for all three or just global?

I've tried a few different configurations but can't get it working.
Here's it is again.

[attachment deleted by admin]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Static linking help 2.0
« Reply #5 on: November 07, 2012, 10:37:59 pm »
Global applies to all configurations. Put there what is common to both, and put in Debug/Release what is specific to each.

And don't forget that the tutorial is about SFML, not Code::Blocks ;)
Laurent Gomila - SFML developer

big_totoro

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Static linking help 2.0
« Reply #6 on: November 07, 2012, 10:55:44 pm »
Haha, that is very true  :)
Sorry, I don't mean to waste your time but I've searched here, googled it and looked through the Code::Blocks manual and can't find it explained anywhere.

So doing what you said, the setup in the file I have attached should work but I still get the error.
Is there anything I'm doing wrong?


[attachment deleted by admin]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Static linking help 2.0
« Reply #7 on: November 08, 2012, 07:50:23 am »
Your project looks good now.

Have you recompiled the application completely ("rebuild" or "clean" + "build")?
Laurent Gomila - SFML developer

big_totoro

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Static linking help 2.0
« Reply #8 on: November 08, 2012, 10:45:22 am »
Tried cleaning and rebuilding and since then, no window opens at all, I just get loads of errors of this type (see attachment). I have tried starting a new project and pasting the code in but still the same problem.

[attachment deleted by admin]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Static linking help 2.0
« Reply #9 on: November 08, 2012, 10:57:42 am »
Did you download the SJLJ version of SFML? You probably need the DW2 version.
Laurent Gomila - SFML developer

big_totoro

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Static linking help 2.0
« Reply #10 on: November 08, 2012, 11:09:03 am »
Just downloaded DW2, cleaned and tried again and it works! I didn't think it would be that since it worked with dynamic.
Sorry for being such a pain and thanks so much for your help. I'm all set up now, time to start learning!
Much appreciated, thanks again  :)