Some strange exception are always thrown on Windows 10.
"Access violation reading location ".
I reduced it to problem code. Everything else, including graphics, sprites, music - working. All libraries are included. But once I put "window.draw(text)" - > I get this exception. It worth noticed that same project is working on Linux. But Windows got some issue.
Please help.
Source code:
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
sf::Font font;
if (!font.loadFromFile("C:/Users/user/source/repos/BattleCity2/media/arial.ttf"))
return EXIT_FAILURE;
sf::Text text("Hello SFML", font, 50);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(text);
window.display();
}
return EXIT_SUCCESS;
}
Call stack:
BattleCity2.exe!af_shaper_get_elem()
BattleCity2.exe!af_shaper_get_elem()
BattleCity2.exe!af_shaper_get_elem()
BattleCity2.exe!FT_Load_Glyph()
BattleCity2.exe!FT_Load_Char()
BattleCity2.exe!sf::Font::loadGlyph(unsigned int,unsigned int,bool,float)
BattleCity2.exe!sf::Font::getGlyph(unsigned int,unsigned int,bool,float)
BattleCity2.exe!sf::Text::ensureGeometryUpdate(void)
BattleCity2.exe!sf::Text::draw(class sf::RenderTarget &,class sf::RenderStates)
BattleCity2.exe!sf::RenderTarget::draw(class sf::Drawable const &,class sf::RenderStates const &)
BattleCity2.exe!main() Line 22