I just downloaded the latest SFML 2, and now I have mysterious crashes when going over the sf::RenderWindow constructor. With this makefile and code, "test 1" is displayed, then the program crashes. I am not very familiar with static linking, so that could be the cause. Any help would be greatly appreciated.
compile = -c -Wall -std=c++0x -g # -mwindows
link = -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -g # -mwindows -lsfml-main
objects = sfmlTesting.o
all: $(objects)
g++ $(objects) $(link) -o sfmlTesting.exe
sfmlTesting.o: sfmlTesting.cpp
g++ sfmlTesting.cpp $(compile)
check-syntax:
g++ -Wall -o nul -std=c++0x -S ${CHK_SOURCES}
#define SFML_STATIC
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
std::cout << "test 1" << std::endl;
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
std::cout << "test 2" << std::endl;
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;
}