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

Author Topic: Program crashes on startup - SFML 2.3  (Read 2008 times)

0 Members and 2 Guests are viewing this topic.

DraGun

  • Newbie
  • *
  • Posts: 21
    • View Profile
Program crashes on startup - SFML 2.3
« on: August 12, 2015, 11:52:01 pm »
So I've been working on this program most of the summer. It's been a good learning experience (finished my first year studying Computer Science, learned a little SFML for the final, then got a job making a program) but I've encountered a number of problems. This problem I cannot find anywhere else on the internet (trust me, I've been looking for hours.) The program starts, the console window comes up, about 5 seconds or less pass, and then the program crashes. After running the debugger (using Visual Studio 2013) it breaks in some code in "crtexe.c." Essentially it's breaking in code that I haven't written. Here's a screenshot of the debugger and where it's breaking:   http://imgur.com/129W9Gz

I have been unable to find any thing else like this online after hours upon hours of research. The reason I'm also not posting any of my code is because it's not breaking within my code, so I don't know what to post that'd be minimal and complete.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Program crashes on startup - SFML 2.3
« Reply #1 on: August 13, 2015, 12:29:10 am »
What happens if you just create an empty main function? Does it also crash?
« Last Edit: August 13, 2015, 06:43:29 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Program crashes on startup - SFML 2.3
« Reply #2 on: August 13, 2015, 01:00:48 am »
Essentially it's breaking in code that I haven't written.
That's probably just a side effect of the real bug (in your code).
Look up the call stack until you get to the nearest function that you did write and look there - there's a good chance the cause of the crash can be found there.

DraGun

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Program crashes on startup - SFML 2.3
« Reply #3 on: August 13, 2015, 06:34:16 pm »
So I noticed it was using some variable from 3DS Max..... No idea why, so I uninstalled 3DS Max and now it's breaking elsewhere, probably because it's now missing that variable. Also, I'm not sure how to trace the call stack. If I'm correct, it shows the call stack in the bottom right, and none of it is anything I've written.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Program crashes on startup - SFML 2.3
« Reply #4 on: August 13, 2015, 11:10:23 pm »
So I noticed it was using some variable from 3DS Max..... No idea why, so I uninstalled 3DS Max and now it's breaking elsewhere, probably because it's now missing that variable.
Sounds like you need to spend some time figuring out what your program is doing...
If you are using variables you don't know where came from and uninstalling some third party program makes a difference, then you really have some issues you need to sort out.
I can't even imagine how one would get oneself into such a situation - honestly.

Also, I'm not sure how to trace the call stack. If I'm correct, it shows the call stack in the bottom right, and none of it is anything I've written.
I see something resembling a stack trace in the bottom right corner of your screenshot; yeah. But, I don't use Visual Studio, so I don't know if what I'm seeing is the actual stack trace or just some "doctored by the IDE to simplify things" version. Someone who knows VS can perhaps answer that.
Personally I'd just use gdb and either step through the program line by line (probably after setting a breakpoint near the interresting bits) and then type "thread apply all bt" to get a full backtrace for all threads.

In any case; If the debugger doesn't seem helpful, then I have these questions for you:

1) Are you using a version of SFML that was built with the exact same compiler that you used to build your application?  If not, then that's most likely the cause of your problem - and building SFML from source with your own compiler is not exactely hard.. So go do that now!

2) Are you perhaps building a release version (with optimizations enabled) of your application but linking to the debug version of SFML (or the other way around)?

More information is needed on the SFML version you use, how you obtained it (binary or source), how you built it, how you link to it, what OS you are on, etc etc...