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

Author Topic: First-chance exception on running the tutorial code  (Read 2107 times)

0 Members and 1 Guest are viewing this topic.

deso

  • Newbie
  • *
  • Posts: 13
    • View Profile
First-chance exception on running the tutorial code
« on: October 08, 2015, 09:23:46 pm »
Hey. I'm trying to set up SFML on Visual Studio 2013, I'm using win7 64 bits.

I'm having troubles, the green circle from the tutorial shows up, but when I click the close button, I get a dialog window with:
"bluerobots.exe has triggered a breakpoint."

or it doesn't give me a dialog window but writes:

"First-chance exception at 0x776A332F (ntdll.dll) in bluerobots.exe: 0xC0000005: Access violation reading location 0x00000004."

or sometimes gives yet another strange error. But these two are the most commom.

Here's the whole code:

Quote
#pragma once
#include <iostream>
#include <SFML\Graphics.hpp>

int main()
{
   sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
   sf::CircleShape shape(100.f);
   shape.setFillColor(sf::Color::Green);
   
   while (window.isOpen())
   {
      sf::Event event;
      while (window.pollEvent(event))
      {
         if (event.type == sf::Event::Closed)
            window.close();
      }

      window.clear();
      window.draw(shape);
      window.display();
   }
   return 0;
}

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: First-chance exception on running the tutorial code
« Reply #1 on: October 08, 2015, 09:26:54 pm »
Make sure you don't mix Release/Debug, compiler versions or other configuration settings between SFML and your project.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

deso

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: First-chance exception on running the tutorial code
« Reply #2 on: October 08, 2015, 11:17:38 pm »
As far as I know, I didn't mix them.

I downloaded the "Visual C++ 12 (2013) - 32-bit" package, and I'm pretty sure I set the libraries called sfml-xxxx-d.lib to the debug, and the regular ones to the release. Again, I'm on win7 64 bit, and using Visual Studio 2013.

What else could it be?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: First-chance exception on running the tutorial code
« Reply #3 on: October 08, 2015, 11:53:50 pm »
If you're only pretty sure, there's still a chance that it is setup wrong. So go check and make sure it's setup correctly.

Next you should provide the call stack of the exception and after that the verbose build command.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

deso

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: First-chance exception on running the tutorial code
« Reply #4 on: October 09, 2015, 07:52:59 pm »
Setup was correct.

I have no clue what a call stack is, or where I can find it. :D

I "solved" it by downloading visual studio 2015 and getting the library for it. It's running properly now.

If you wanna link something about call stacks so I can educate myself I would be thankful. :)

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: First-chance exception on running the tutorial code
« Reply #5 on: October 09, 2015, 08:31:57 pm »
I have no clue what a call stack is, or where I can find it. :D
It's simply a listing of what functions have called what other fjnctions leading up to where you are currently at.
Your debugger can show you one.

 

anything