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

Author Topic: An odd problem  (Read 1418 times)

0 Members and 1 Guest are viewing this topic.

GreenBug

  • Newbie
  • *
  • Posts: 3
    • View Profile
An odd problem
« on: October 19, 2011, 07:01:58 pm »
Whenever I run my program it immediatley crashes. I have no idea why, and I get this message in the console.
 
Quote
Unhandled Exception: System.AccessViolationExeption: Attempt to read or write protected memory. This is often an indication that other memory is corrupt.
at sf.RenderTarget.Clear(RenderTarget* , Color* )
at main()
at _mainCRTStartup()


I don't think it's my code, but here it is for what it's worth.

Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Heavy");
 
    sf::Image Image;

    if (!Image.LoadFromFile("heavy.tga")) return EXIT_FAILURE;

    sf::Sprite Sprite(Image);

    Sprite.SetPosition(200.f, 100.f);
   
    while (App.IsOpened())
    {
        sf::Event Event;

        while (App.GetEvent(Event))
        {
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }
       
        App.Clear();
        App.Draw(Sprite);
        App.Display();
    }

    return EXIT_SUCCESS;
}


Thanks for reading, and I hope someone knows what's wrong.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
An odd problem
« Reply #1 on: October 19, 2011, 07:12:52 pm »
Version of SFML?
Static or dynamic libraries?
OS?
Compiler?

Don't forget the rules ;)
Laurent Gomila - SFML developer

GreenBug

  • Newbie
  • *
  • Posts: 3
    • View Profile
An odd problem
« Reply #2 on: October 19, 2011, 09:06:59 pm »
Sorry about that.

1.6, static, windows 7, and Microsoft's visual c++ compiler.

Hope that helps.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
An odd problem
« Reply #3 on: October 19, 2011, 09:11:09 pm »
Quote
Microsoft's visual c++ compiler

Which version?
Laurent Gomila - SFML developer

GreenBug

  • Newbie
  • *
  • Posts: 3
    • View Profile
An odd problem
« Reply #4 on: October 20, 2011, 06:46:50 am »
Quote
Which version?
2010

I may just try a different compiler and environment and see how that goes.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
An odd problem
« Reply #5 on: October 20, 2011, 07:47:11 am »
Visual C++ 2010 cannot use libraries that were compiled with Visual C++ 2008. So you have to recompile SFML.
Laurent Gomila - SFML developer

 

anything