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

Author Topic: Creating a sf::RenderWindow outputs a weird segmentation fault error  (Read 2561 times)

0 Members and 1 Guest are viewing this topic.

Kosmos

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Hello,

I'm making a small game; using SFML 1.6. I've ran this program many times, and for some reason, when I do now, (on the same machine) I get a segmentation fault. I decided to use debugging symbols and use the gdb debugger to get a more detailed segmentation fault message, and I get a really weird one.

Here is the code:
//...
std::cout<<"Starting video..."<<std::endl;
  App.Create(sf::VideoMode(SCR_WIDTH,SCR_HEIGHT,32),"Qubit");
  std::cout<<"Video started"<<std::endl;
  App.SetFramerateLimit(FPS);
//...
 

Here is the output of the gdb debugger:
(gdb) run
Starting program: /home/samuel/programming/cpp/qubit/qubit
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
Running Qubit...

Starting video...

Program received signal SIGSEGV, Segmentation fault.
__GI_getenv (name=0xb78953b2 "TEL_NO_BLIT") at getenv.c:90
90      getenv.c: No such file or directory.
(gdb)
 

I think the error is in the App.Create(sf::VideoMode(SCR_WIDTH,SCR_HEIGHT,32),"Qubit"); line, as "Video started" should have been printed if everything went well, and it didn't print.

SCR_WIDTH is 1024, and SCR_HEIGHT is 768, which is perfectly fine, my screen is 1366x768.
My operating system is Ubuntu Linux 12.04 (precise) 32-bit; Kernel version 3.2.0-31-generic-pae.

Can you guys tell me what the hell is this error? and why is there a segmentation fault?

Cheers,
Kosmos.
« Last Edit: December 29, 2012, 05:53:47 pm by Kosmos »

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Re: Creating a sf::RenderWindow outputs a weird segmentation fault error
« Reply #1 on: December 29, 2012, 05:58:45 pm »
Other than suggesting you to start using SFML 2 I have no idea, it may be a bug old 1.6 had that won't ever be fixed due to version shift towards SFML 2.
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!

Kosmos

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Creating a sf::RenderWindow outputs a weird segmentation fault error
« Reply #2 on: December 29, 2012, 06:17:23 pm »
Well, SFML 1.6 is the latest stable release, so I doubt there is a bug. SFML 2 is in beta state, so it probably has more bugs than 1.6 does.

It can be a possibility though, perhaps Laurent knows something about it.

Cheers,
Kosmos.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Creating a sf::RenderWindow outputs a weird segmentation fault error
« Reply #3 on: December 29, 2012, 06:31:38 pm »
SFML 2.0 is better and faster than 1.6, period.
Back to C++ gamedev with SFML in May 2023

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Creating a sf::RenderWindow outputs a weird segmentation fault error
« Reply #4 on: December 29, 2012, 06:33:43 pm »
Well, SFML 1.6 is the latest stable release, so I doubt there is a bug.
If you work on a bigger software project, there is a complexity which makes it extremely and difficult to detect and fix every single bug. And the fact that SFML depends on a lot of external libraries and the correct functioning of drivers doesn't make it simpler. So yes, there are of course bugs in SFML 1.6, of which a lot have been fixed meanwhile.

By the way, stable also means that the API doesn't change.

SFML 2 is in beta state, so it probably has more bugs than 1.6 does.
No, SFML 2 is not in beta state, there is already a release candidate. Many issues from SFML 1.6 have been fixed or disappeared as a result of better design, additionally there are a lot of new features. You should really use SFML 2.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything