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

Author Topic: MSVC cookie instrumentation exception when in release mode  (Read 86 times)

0 Members and 1 Guest are viewing this topic.

2bdkid

  • Newbie
  • *
  • Posts: 2
    • View Profile
MSVC cookie instrumentation exception when in release mode
« on: April 30, 2020, 03:07:31 am »
I'm on MSVC (VC Community 2019) and I just built SFML from source, debug and release shared libraries.

I copied the example code from sf::Window documentation

int main() {
    // Declare and create a new window
    sf::Window window(sf::VideoMode(800, 600), "SFML window");
    // Limit the framerate to 60 frames per second (this step is optional)
    window.setFramerateLimit(60);
    // The main loop - ends as soon as the window is closed
    while (window.isOpen()) {
        // Event processing
        sf::Event event;
        while (window.pollEvent(event)) {
            // Request for closing the window
            if (event.type == sf::Event::Closed)
                window.close();
        }
        // Activate the window for OpenGL rendering
        window.setActive();
        // OpenGL drawing commands go here...
        // End the current frame and display its contents on screen
        window.display();
    }
}


When I build and run in debug mode it appears to work. When I compile and run through release mode (specifically when I close the window) I get

Unhandled exception at 0x00007FF6D7C62104 in graphics.exe: Stack cookie instrumentation code detected a stack-based buffer overrun. occurred


This comes from gs_report.c, I'm not sure if this is part of SFML or windows. The call stack does not indicate how it got to this exception.

2bdkid

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: MSVC cookie instrumentation exception when in release mode
« Reply #1 on: April 30, 2020, 03:14:36 am »
Turns out it was compiling for release with debug info. I deleted all the build files and switched to release mode and it's working fine now.

 

anything