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

Author Topic: Welp, this is a good start: "Run-Time Check Failure #2"  (Read 1564 times)

0 Members and 2 Guests are viewing this topic.

Volatar

  • Newbie
  • *
  • Posts: 10
    • View Profile
Welp, this is a good start: "Run-Time Check Failure #2"
« on: November 17, 2014, 10:21:55 am »
"Run-Time Check Failure #2 - Stack around the variable 'window' was corrupted." is the full error message. Couldn't fit it into the title. Don't think I need to from my Googling. Quite a few instances of the same error pop up.

When does this error occur and with what code?

Code is right from the test at the end of the Visual Studio tutorial:

(click to show/hide)

I get the error when I hit the X to close the little window. First time it came up I hit continue instead of break and I can't end the program anymore xD. Had to reboot to fix that. No big deal. Hitting break allows me to kill it thankfully.

Now here is where it gets interesting I think: two solutions come up in my Googling:

Either A: I am using a version of the library compiled for a different compiler.
or B: I have mixed up my linking between debug and release.

A: Yes, I am running Visual Studio 2013 (update 4). However, I compiled the libraries myself mere minutes before, so that should not be the problem.
B: I keep checking *checks again*... yep, I got the linking right. -d to debug, no -d to release.

I will note that release builds do not throw this error message, but that's because the release build lacks the error handling the debug one does I think. I could be wrong though.

So, any thoughts? Need any more information? I am happy to provide.


Volatar

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Welp, this is a good start: "Run-Time Check Failure #2"
« Reply #1 on: November 17, 2014, 10:34:11 am »
Ah ha! Moments after posting I figured out the problem. But I am not going to be that guy and just say "I fixed it" and move on.

What did I do wrong?

Well, when I compiled, I then moved the things I needed out of the various... stuff created by cmake (the .libs and .dll's) to my project files. However, I also needed the includes, so I simply copied those over to my project folder and moved on.

What I did wrong was I copied the wrong includes folder. I copied the one from the 2.1 stable branch I had open to check if I was getting the right things I needed. I should have copied them from the source code I had downloaded, which is more up to date than the 2.1 stable it seems, even though they are next to each other on the download page.

Hope this helps someone in the future. :)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Welp, this is a good start: "Run-Time Check Failure #2"
« Reply #2 on: November 17, 2014, 11:13:52 am »
You should always use the headers which where used to build SFML. Don't build from SFML 2.1 source and then use the master headers...
What you shouldn't do is copy the headers to your project directory. Check the official tutorials on how to properly setup your environment.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

fakepotato

  • Newbie
  • *
  • Posts: 39
    • View Profile
    • Email
Re: Welp, this is a good start: "Run-Time Check Failure #2"
« Reply #3 on: November 17, 2014, 10:49:31 pm »
Do you use MD linking for release and MTd for debugging? That's important.
And ofc use -d libs for debugging and those without -d to release :-)
Infinite insomnia.