SFML community forums

Help => General => Topic started by: bigfoot on April 23, 2017, 07:59:44 pm

Title: [SOLVED]SFML Segmentation fault
Post by: bigfoot on April 23, 2017, 07:59:44 pm
Hello,

I am having a problem with the library. When creating a simple program:
int main() {
   sf::Texture texture;
}
 


I get [1] 6699 Segmentation fault (core dumped) <program path>

When running it in gdb I get
in ?? () from /usr/lib/libsfml-window.so.2.4
in ?? () from /usr/lib/libsfml-window.so.2.4
in ?? () from /usr/lib/libsfml-window.so.2.4
in sf::Texture::Texture() () from /usr/lib/libsfml-graphics.so.2.4

Some other information:
OS: Archlinux
SFML version: 2.4 (tried sfml-git and sfml packages)

This is how I compiled my program:

g++ main.cpp -o main -lsfml-graphics -lsfml-system

Thank you very much in advance
Title: Re: SFML Segmentation fault
Post by: eXpl0it3r on April 23, 2017, 08:21:43 pm
Try building SFML as debug libs and run it again, that way we should get a more useful stack trace.
Does a normal example work fine?
Title: Re: SFML Segmentation fault
Post by: bigfoot on April 23, 2017, 08:46:22 pm
Hello,

Thank you very much for your response. So, I compiled sfml in debug mode (-DCMAKE_BUILD_TYPE=Debug). Unfortunately, I get the same problems, without any further information, even when compiling my program with "-g -O0".

I also tried the example given here (https://github.com/SFML/SFML/wiki/Tutorial:-Build-your-SFML-project-with-CMake), but without any luck, same result.

Thank you again for all your help.
Title: Re: SFML Segmentation fault
Post by: eXpl0it3r on April 23, 2017, 08:56:40 pm
If you don't get more information on the stack trace, then you probably didn't link against the debug libraries.

And you're saying that no SFML example works? That would sound to me as if you didn't install any OpenGL driver then.
Title: Re: SFML Segmentation fault
Post by: bigfoot on April 23, 2017, 10:41:35 pm
Thank you very much for your response  :)

After noticing that opengl was indeed not installed, it now works :)

Thank you :)