I'm running with the 1.5 packages installed from synaptic on ubuntu and I'm getting the crash too. I'm not linking against the debug libraries, just the regular ol static libraries.
When I call window.Clear() I get a seg fault. When I call glClearColor(...) followed by glClear(GL_COLOR_BUFFER_BIT) it runs just fine. Until someone figures out why window.Clear() is dying on me I'll jsut use glClear as a workaround.
:?
Edit:
I played around a little bit and have no idea what the problem is. I looked at the source and I can't see anything that could be going wrong. I tried remaking the exact code that Clear calls, but when I do that it runs fine.
bool Activate(sf::RenderWindow& App, bool Active)
{
if (Active)
return App.SetActive();
else
return false;
}
void Clear(sf::RenderWindow& App, const sf::Color& FillColor)
{
if (Activate(App, true))
{
glClearColor(FillColor.r / 255.f, FillColor.g / 255.f, FillColor.b / 255.f, FillColor.a / 255.f);
glClear(GL_COLOR_BUFFER_BIT);
Activate(App, false);
}
}
int main()
{
// Create the main rendering window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
// Start game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
}
// Clear the screen (fill it with black color)
//App.Clear(sf::Color(0, 0, 0));
// Uncommenting the line above crashes, yet the one below works fine.
Clear(App, sf::Color(0, 0, 0));
// Display window contents on screen
App.Display();
}
Baffling. I did notice that SFML_DEBUG was defined, even though I'm not linking against the debug libraries as far as I know.
game : *.cpp *.h
g++ -o game \
main.cpp Border.cpp Game.cpp Widget.cpp \
-I/usr/local/include/luajit-2.0 -lluajit-5.1 \
-lsfml-graphics -lsfml-window -lsfml-system -Wall -Weffc++ -Wextra \
-Wshadow -Wformat-nonliteral -Wformat-security -Winit-self -Wundef