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

Author Topic: Code Blocks won't static link SFML  (Read 4639 times)

0 Members and 1 Guest are viewing this topic.

Phlix

  • Newbie
  • *
  • Posts: 6
    • View Profile
Code Blocks won't static link SFML
« on: February 13, 2011, 09:24:27 am »
Hello,

I have an ATI card and since I've updated my drivers everything's been messed up. I'm aware that the common workaround is static linking, but I cannot manage to get it right.

I've changed the linker options to include the '-s' suffix and I've declared SFML_STATIC in the #defines for my compiler. I've downloaded Laurent's prepackaged MinGW with gcc4.4 and configured Code Blocks to use it. I've also run the batch file the in the windows SDK in order to build SFML statically. And yet I still get the dreaded console window which can only be terminated abnormally.

I feel that some how I'm still not telling Code Blocks to link SFML statically. I've combed the forums forever on this and I hate making new threads, and I've even considered going back to SDL, but I love the clean and lean SFML too much to let go.

Please help!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Code Blocks won't static link SFML
« Reply #1 on: February 13, 2011, 09:53:16 am »
SFML_STATIC is for SFML 2.x, but the batch file is only provided for SFML 1.x, so there's a mismatch somewhere ;)

Which version do you (want to) use?
Laurent Gomila - SFML developer

Phlix

  • Newbie
  • *
  • Posts: 6
    • View Profile
Code Blocks won't static link SFML
« Reply #2 on: February 13, 2011, 09:59:41 am »
Sorry for not specifying. I am using SFML 1.6. Would switching to SFML 2 enable me to static link and hence work around my driver problem? I'd rather stay in 1.6 since that's what I'm currently using but I'll switch if it means I can keep using SFML!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Code Blocks won't static link SFML
« Reply #3 on: February 13, 2011, 10:01:10 am »
You can stay with 1.6, but then you have to define SFML_DYNAMIC for dynamic version (and nothing for static), SFML_STATIC is for 2.0 only.
Laurent Gomila - SFML developer

Phlix

  • Newbie
  • *
  • Posts: 6
    • View Profile
Code Blocks won't static link SFML
« Reply #4 on: February 13, 2011, 10:04:54 am »
Well I don't really want to downgrade my drivers as I don't even know which version works, so I'll switch to SFML 2!

Is there a page that lists all the things in the code that must change for the upgrade? I already know i can define SFML_STATIC  :wink:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Code Blocks won't static link SFML
« Reply #5 on: February 13, 2011, 10:07:19 am »
SFML 2 and SFML 1.6 exactly have the same problems regarding ATI drivers, you don't need to switch.

Quote
Is there a page that lists all the things in the code that must change for the upgrade?

No :D
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Code Blocks won't static link SFML
« Reply #6 on: February 13, 2011, 12:23:11 pm »
Most API changes should result in compiler errors.

However, the interface of sf::Rect has changed, which is very dangerous for existing code to compile with logic errors.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Phlix

  • Newbie
  • *
  • Posts: 6
    • View Profile
Code Blocks won't static link SFML
« Reply #7 on: February 15, 2011, 07:00:17 am »
I have just upgraded to SFML-2.0, and changed all the sf::Rect code (and all the other compiler errors) and can FINALLY link statically.

As I thought, I am able to run my game again even with my ATI drivers. The thing that got me for so long was that I had no idea SFML-1.6 could not be built statically. Somehow all in all that forum combing I never figured it out  :?

Anyway I hope this helps anyone who had similar problems!

Thanks for replies!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Code Blocks won't static link SFML
« Reply #8 on: February 15, 2011, 07:52:22 am »
Quote
The thing that got me for so long was that I had no idea SFML-1.6 could not be built statically. Somehow all in all that forum combing I never figured it out

Sorry if it was not clear before: SFML 1.6 can be linked statically.

When I said "nothing for static" I meant that you don't need to define any preprocessor symbol for the static version to work.
Laurent Gomila - SFML developer

Phlix

  • Newbie
  • *
  • Posts: 6
    • View Profile
Code Blocks won't static link SFML
« Reply #9 on: February 16, 2011, 08:44:40 am »
Ah!

Well, all I did was add the -s suffix to the linker options. Perhaps I forgot something else. The macro for SFML-2 worked though so I'm happy!