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

Author Topic: SFML static link errors in code::blocks  (Read 7753 times)

0 Members and 1 Guest are viewing this topic.

12345

  • Newbie
  • *
  • Posts: 15
    • View Profile
SFML static link errors in code::blocks
« on: July 07, 2014, 10:08:07 pm »
Excuse me for my error in english.
I tried many times to compile statically sfml in projects with code::blocks, but the linker show me a lot of undefined reference to gl, glew, jpeg and many others. I haven't these libraries in my compiler folder beacause I think they are alredy included by sfml. I also recompiled SFML with cmake and code::blocks, but nothing changed. Can someone help me?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: SFML static link errors in code::blocks
« Reply #1 on: July 07, 2014, 10:29:53 pm »
I assume this is related to the fact that they changed how static linking works sometime after 2.1, i.e. those libraries are not automatically included by SFML anymore.  See https://github.com/SFML/SFML/wiki/FAQ#build-link-static

12345

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: SFML static link errors in code::blocks
« Reply #2 on: July 08, 2014, 09:31:12 am »
Thanks for the fast reply. Code::blocks now can work statically sfml, but there is another problem. Now, if I run my project and I close it using X of the window, appears "sfml has stopped working" and the return value isn't 0. I added to this message a screenshot of my linked libraries. The project is the test project that can be found at the end of "How set up SFML in Code::Blocks". My os is windows 8.1, 4gb of ram, intel core i3, amd radeon graphics, 1gb of video memory.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: SFML static link errors in code::blocks
« Reply #3 on: July 08, 2014, 09:59:02 am »
Run it with a debugger and see where it crashes.
Where did you get SFML from and what's your compiler?
And you sure did use the code from here 1:1?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

12345

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: SFML static link errors in code::blocks
« Reply #4 on: July 08, 2014, 10:35:13 am »
GNU Debugger tell me SIGSEGV, Callstack: address 004DC3AD, Function ?? 0. What does it mean?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: SFML static link errors in code::blocks
« Reply #5 on: July 08, 2014, 10:41:23 am »
Are you using the debug builds in debug mode?

Also please answer all questions...
Where did you get SFML from and what's your compiler?
And you sure did use the code from here 1:1?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

12345

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: SFML static link errors in code::blocks
« Reply #6 on: July 08, 2014, 10:55:35 am »
I run debugger with a release application. Code::blocks while is compiling the debug application say a lot of undefined reference to _imp_ZN2.... . My questions changed when I get another error that hasn't appared before. Excuse me if it isn't the normal form of topics.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: SFML static link errors in code::blocks
« Reply #7 on: July 08, 2014, 11:09:11 am »
If you see "_imp_" references then you're trying to link dynamically. You might have forgotten to declare SFML_STATIC for your debug project.

I'm still waiting for an answer on "Where did you get SFML from and what's your compiler?"
If you fail to answer this for the third time, you'll need to rely on someone else to help you further...
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

12345

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: SFML static link errors in code::blocks
« Reply #8 on: July 08, 2014, 11:18:13 am »
Sorry I have forgotten it. I get SFML by the official download page (GCC4.7 TDM (SJLJ)- 32 bits). For compiling my projects I use code::blocks with mingw-tdm 32 bits 4.71. I declared SFML_STATIC both release and debug.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFML static link errors in code::blocks
« Reply #9 on: July 08, 2014, 11:28:15 am »
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

12345

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: SFML static link errors in code::blocks
« Reply #10 on: July 08, 2014, 11:37:24 am »
Here is the build log.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: SFML static link errors in code::blocks
« Reply #11 on: July 08, 2014, 11:38:44 am »
As you can see from the build command, there's no SFML_STATIC to be seen, which means it isn't declared for you debug mode. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

12345

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: SFML static link errors in code::blocks
« Reply #12 on: July 08, 2014, 11:41:16 am »
But i do this.

12345

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: SFML static link errors in code::blocks
« Reply #13 on: July 08, 2014, 11:50:12 am »
I solved for debug mode. It is a code::blocks bug: when after a failed build I tried to build project, if I changed some build options they'll be used only using rebuild not build. But I haven't solved the problem with release.

12345

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: SFML static link errors in code::blocks
« Reply #14 on: July 08, 2014, 11:58:40 am »
I finally solved the problem. Code::blocks as default use -o2 for release project, but sfml probably isn't compiled with -o1, -o2 or -o3 so they can't be used in a project. Can someone tell me if sfml hasn't been compiled with those "symbols"?

 

anything