Hello,
i've used sfml with Visual Studio now for a while. Now i wanted to use sfml with Code::Blocks.
I installed everything and followed the SFML and Code::Blocks (MinGW) tutorial. I installed the GCC 4.8.1 TDM (SJLJ) - 64-bit sfml version and the TDM 4.8.1 (64-bit) compiler linked on the sfml download page.
I compiled the example from the SFML and Code::Blocks (MinGW) tutorial and there were no errors. But when i start the programm it doesn't work. The sfml window pops up with a white screen and the correct text but there come directly a windows window which say that the program doesn't work any longer (the exact text in german: Testing.exe funktioniert nicht mehr).
Here is the code i compiled (i just copied it from the tutorial):
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
If i now compile this code:
#include <SFML/Graphics.hpp>
int main()
{
sf::Vector2f vec;
vec.x = 8;
std::cout << vec.x << std::endl;
return 0;
}
everything works and the "8" is showing up in the console window.
I also just compiled this:
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
return 0;
}
the same "Testing.exe doesn't work any longer" window pops up when i start the program (there were again no errors when i compiled it).
It seems that the problem is the sf::RenderWindow, but what exactly is wrong here?