# sfml drawing text c++

using visual studio 2015 and SFML . relevant code:

sf::Font font;
sf::Text text;
text.setFont(font);
text.setString("hello ");
_mainWindow.draw(text);


It doesn't display the text. I put a breakpoint, the font gets the correct value. but the text's string stays empty. for the main window I get: + _mainWindow sf::RenderWindow

Can anybody help?

thanks

• Could you share some code around this. Is this in a method? A class? Could you show how it is called? How is _mainWindow actually passed to it? – Tyyppi_77 Feb 26 '17 at 10:44