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

Author Topic: [SOLVED]SFML Segmentation fault  (Read 2255 times)

0 Members and 1 Guest are viewing this topic.

bigfoot

  • Newbie
  • *
  • Posts: 3
    • View Profile
[SOLVED]SFML Segmentation fault
« 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
« Last Edit: April 23, 2017, 10:41:55 pm by bigfoot »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10800
    • View Profile
    • development blog
    • Email
Re: SFML Segmentation fault
« Reply #1 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?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

bigfoot

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SFML Segmentation fault
« Reply #2 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, but without any luck, same result.

Thank you again for all your help.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10800
    • View Profile
    • development blog
    • Email
Re: SFML Segmentation fault
« Reply #3 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

bigfoot

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SFML Segmentation fault
« Reply #4 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 :)

 

anything