Reputation: 15
I am trying to get SFML working wtih Qt creator for the last 2 days but it just isn't working. The program fails at creating a new window and I am not sure why.
Application output
Starting E:\Programiranje\QT programi\build-SMFLConsoleGame-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\SMFLConsoleGame.exe...
The program has unexpectedly finished.
E:\Programiranje\QT programi\build-SMFLConsoleGame-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\SMFLConsoleGame.exe crashed
Compile output
14:57:51: Running steps for project SMFLConsoleGame...
14:57:51: Configuration unchanged, skipping qmake step.
14:57:51: Starting: "E:\Programiranje\QT\Tools\mingw482_32\bin\mingw32-make.exe"
E:/Programiranje/QT/Tools/mingw482_32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'E:/Programiranje/QT programi/build-SMFLConsoleGame-Desktop_Qt_5_3_MinGW_32bit-Debug'
g++ -c -pipe -fno-keep-inline-dllexport -g -std=c++0x -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_CORE_LIB -I..\SMFLConsoleGame -I"..\..\SFML\include\SFML" -I"..\..\QT\5.3\mingw482_32\include" -I"..\..\QT\5.3\mingw482_32\include\QtCore" -I"debug" -I"." -I"..\..\QT\5.3\mingw482_32\mkspecs\win32-g++" -o debug\main.o ..\SMFLConsoleGame\main.cpp
g++ -Wl,-subsystem,console -mthreads -o debug\SMFLConsoleGame.exe debug/main.o -LE:/Programiranje/SFML/lib -lsfml-system -lsfml-window -lsfml-graphics -lsfml-audio -LE:/Programiranje/QT/5.3/mingw482_32/lib -lQt5Cored
mingw32-make[1]: Leaving directory 'E:/Programiranje/QT programi/build-SMFLConsoleGame-Desktop_Qt_5_3_MinGW_32bit-Debug'
14:57:52: The process "E:\Programiranje\QT\Tools\mingw482_32\bin\mingw32-make.exe" exited normally.
14:57:52: Elapsed time: 00:02.
.pro
QT += core
QT -= gui
TARGET = SMFLConsoleGame
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
LIBS+= -LE:/Programiranje/SFML/lib \
-lsfml-system \
-lsfml-window \
-lsfml-graphics \
-lsfml-audio
INCLUDEPATH += E:/Programiranje/SFML/include/SFML
CONFIG += c++11
main.cpp
#include <iostream>
#include "System.hpp"
#include "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;
}
Upvotes: 0
Views: 379
Reputation: 138
Hello Habsburg and welcome to stack exchange! I currently don't have a setup to test this but my suspicion is that you are using the wrong library. I noticed that you are using mingw and if you look at the sfml download page there are 2 types of libraries (the SJLJ and the DW2) and using the wrong one can lead to a crash but then, the debug output can tell more about the issue.
Upvotes: 1