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

Author Topic: Documentation tutorial  (Read 1277 times)

0 Members and 1 Guest are viewing this topic.

Cerberus

  • Newbie
  • *
  • Posts: 3
    • View Profile
Documentation tutorial
« 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Documentation tutorial
« Reply #1 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 ;)
Laurent Gomila - SFML developer

Cerberus

  • Newbie
  • *
  • Posts: 3
    • View Profile
Documentation tutorial
« Reply #2 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

 

anything