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

Author Topic: SIGSEGV, Segmentation fault ( 0xC0000005 ) error by using static library  (Read 2611 times)

0 Members and 1 Guest are viewing this topic.

DutchmanDavid

  • Guest
I've been setting up a basic SFML program in Code::Blocks using the static library, but I've been stuck at this seg fault problem.
Using debug I've found out that my app object gets the variables in a strange order:
sf::VideoMode::VideoMode(this=0x320, modeWidth=600, modeHeight=32, modeBitsPerPixel=1980298368)

As you can see, this gets the value 0x320 (which is 800 decimal) modeWidth gets 600, but should get 800, modeHeight gets 32 but should get 600, etc. All the parameters are in the wrong place! :I

The project can be found on https://github.com/DavidHulsmanNL/Graphics

main.cpp currently only contains this:

#include <SFML/Graphics.hpp>

int main()
{
        sf::Window app( sf::VideoMode(800,600), "SFML window" );
       
        return 0;
}
 

I've added SFML_STATIC to the #defines in the build options and I've added the static libraries to the correct linker settings.

I've never been able to setup SFML using static libraries, so I'll need some help :)

If I forgot anything, ask away!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SIGSEGV, Segmentation fault ( 0xC0000005 ) error by using static library
« Reply #1 on: December 13, 2012, 09:33:22 pm »
Version of SFML? Version of the compiler?
Laurent Gomila - SFML developer

DutchmanDavid

  • Guest
Re: SIGSEGV, Segmentation fault ( 0xC0000005 ) error by using static library
« Reply #2 on: December 13, 2012, 10:07:15 pm »
gcc version 4.7.1 (from the new and fancy Code::Blocks 12.11, released a few days ago)
SFML 2.0 RC

If I'm learning SFML I might as well learn the future version :p

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SIGSEGV, Segmentation fault ( 0xC0000005 ) error by using static library
« Reply #3 on: December 13, 2012, 10:47:26 pm »
You must recompile SFML, none of the precompiled packages is compatible with gcc 4.7.
Laurent Gomila - SFML developer

DutchmanDavid

  • Guest
Re: SIGSEGV, Segmentation fault ( 0xC0000005 ) error by using static library
« Reply #4 on: December 14, 2012, 12:51:34 pm »
It worked! Thanks for the help! By the way, is there any way I can find out myself whether I need to recompile if I update Code::Blocks in the future? Any clues I should look for?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SIGSEGV, Segmentation fault ( 0xC0000005 ) error by using static library
« Reply #5 on: December 14, 2012, 02:55:24 pm »
No, it's really difficult to find out which versions of gcc are compatible with each other. The known causes of incompatibility so far:
- the threading model (win32 vs pthread)
- the exception model (sjlj vs dw2)
- the C++ standard (c++03 vs c++11)
Laurent Gomila - SFML developer