Hello everyone!
I've just started learning SFML.
I'm using VirtualBox (4.3.6) and Windows 7 (32 bit) as guest OS, Visual Studio 2010. SFML 2.2.
I follow instuctions in manual
http://www.sfml-dev.org/tutorials/2.2/start-vc.php .
Everything works fine except
window.draw(shape);
It causes to error "Unhandled exception at 0x00000000 in Lab7.exe: 0xC0000005: Access violation reading location 0x00000000".
Call stack
00000000()
sfml-graphics-d-2.dll!6ed176a2()
[Frames below may be incorrect and/or missing, no symbols loaded for sfml-graphics-d-2.dll]
sfml-graphics-d-2.dll!6ed172f2()
sfml-graphics-d-2.dll!6ed16a96()
sfml-graphics-d-2.dll!6ed3bb09()
sfml-graphics-d-2.dll!6ed16a13()
sfml-graphics-d-2.dll!6ed399c6()
sfml-graphics-d-2.dll!6ed16a13()
> Lab7.exe!main() Line 33 + 0x1b bytes C++
Lab7.exe!__tmainCRTStartup() Line 555 + 0x19 bytes C
Lab7.exe!mainCRTStartup() Line 371 C
kernel32.dll!758d1194()
ntdll.dll!7748b459()
ntdll.dll!7748b42c()
Without this line of code everything works fine and I see window. I can change its position and color. But I cannot draw something on it. Even for example text:
// Declare and load a font
sf::Font font;
if (!font.loadFromFile("C:\\Windows\\Fonts\\Arial.ttf"))
{
printf("Failed!");
return EXIT_FAILURE;
}
// Create a text
sf::Text text("hello", font);
text.setCharacterSize(30);
text.setStyle(sf::Text::Bold);
text.setColor(sf::Color::Red);
// ...
window.draw(text);