SFML community forums

Help => General => Topic started by: Cerberus on August 30, 2011, 01:10:46 pm

Title: Documentation tutorial
Post by: Cerberus on August 30, 2011, 01:10:46 pm
This has got me stumped and very annoyed.

Just come back to SFML, used it in my second year at uni, and then in third year we went on to OpenGL, which I hated.
So now I'm trying to make some simple 2D games for my portfolio.

However, I'm stuck at just getting a simple SFML window to display.
The clock example in the tutorial for setting up sfml worked, and I have no link errors.

Here's my code
Code: [Select]


#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
    //create main window
sf::RenderWindow App(sf::VideoMode(800,600), "SFML test");


sf::Image Image;
if(!Image.LoadFromFile("ball.jpg"))
return EXIT_FAILURE;
sf::Sprite Sprite(Image);

while(App.IsOpened())
{
sf::Event Event;
std::cout << "event created" << std::endl;
while(App.GetEvent(Event))
{
std::cout << "inside while loop" << std::endl;
if(Event.Type == sf::Event::Closed)
App.Close();

}

//clear window
App.Clear();

App.Draw(Sprite);


//update window
App.Display();


}




    return EXIT_SUCCESS;
}


When I run with debugging, the error I get is :
Quote

Microsoft Visual Studio C Runtime Library has detected a fatal error in sfml-test.exe.
.
If I enter debugging, it says its on the line with "while(App.GetEvent(Event))".  (There is a green arrow on the line).


Still reacquainting myself with visual studio as I've been doing a lot of java in netbeans recently.

Can anyone help me before I start pulling my hair out?

Thanks
Title: Documentation tutorial
Post by: Laurent on August 30, 2011, 01:23:13 pm
1. Never use release libraries in debug mode
2. Never use 2008 libraries with VC 2010

Choose whichever applies to your situation ;)
Title: Documentation tutorial
Post by: Cerberus on August 30, 2011, 02:03:03 pm
thank you thank you thank you thank you thank you.


I'd got the debug version of sfml-graphics-d.dll, but I'd forgot to put the -d on the end of window.dll.

I knew it couldn't have been the code, but couldn't see the issue.

Did I say thank you?  :D