SFML community forums

Help => General => Topic started by: Kosmos on December 29, 2012, 05:48:36 pm

Title: Creating a sf::RenderWindow outputs a weird segmentation fault error
Post by: Kosmos on December 29, 2012, 05:48:36 pm
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.
Title: Re: Creating a sf::RenderWindow outputs a weird segmentation fault error
Post by: masskiller 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.
Title: Re: Creating a sf::RenderWindow outputs a weird segmentation fault error
Post by: Kosmos 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.
Title: Re: Creating a sf::RenderWindow outputs a weird segmentation fault error
Post by: FRex on December 29, 2012, 06:31:38 pm
SFML 2.0 is better and faster than 1.6, period.
Title: Re: Creating a sf::RenderWindow outputs a weird segmentation fault error
Post by: Nexus 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.