Ok so I'm relatively new to programming (and even more so to games programming), having moved onto SFML from SDL. I'm using Code::Blocks 13.12 and downloaded "GCC 4.7 MinGW (DW2) - 32 bits" from the SFML 2.1 Downloads section, however when making a very simple test for making and drawing text I get a crash (Text Test.exe has stopped working) when I use the setString function.
Here is my code:
#include <SFML\Graphics.hpp>
#include <iostream>
sf::RenderWindow window;
int main(){
window.create(sf::VideoMode(640, 480), "Text Test");
sf::Font foBasic;
if(!foBasic.loadFromFile("basic.ttf")){
std::cout << "Could not load font :(\n";
}
sf::Text myText;
myText.setFont(foBasic);
std::cout << "font set\n";
myText.setString("pls wurk");
//^Commenting this out makes the program run, although there is no text to draw so the screen stays blank
std::cout << "string set\n";
myText.setCharacterSize(24);
myText.setColor(sf::Color(255, 255, 100));
myText.setPosition(0, 0);
while(window.isOpen()){
sf::Event event;
while(window.pollEvent(event)){
if(event.type==sf::Event::Closed){
window.close();
}
}
window.clear();
window.draw(myText);
window.display();
}
return 0;
}
The output I get before the crash is "font set".
My search directories are correct and my linker settings are as follows:
C:\SFML-2.1\lib\libsfml-graphics.a
C:\SFML-2.1\lib\libsfml-main.a
C:\SFML-2.1\lib\libsfml-system.a
C:\SFML-2.1\lib\libsfml-window.a
My build target is Release. I have used many other features SFML offers without any errors like this so this particular issue seems weird since I can't find anything about it anywhere. Any help is appreciated
EDIT:
This is apparently the same as my issue
https://github.com/SFML/SFML/issues/5However I don't really understand the solution and it sounds like that particular issue is specifically for Mac whereas I am on Windows 7.