简体   繁体   中英

Qt Creator not displaying SFML windows

I've recently set up qt creator to work with SFML, and I tried running a piece of code as a test to see if it works. I must note the code bellow works perfectly in Codeblocks IDE but in qt creator it simply displays a console with the text "Press RETURN to close this window..."

#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <iostream> 

using namespace std;
using namespace sf;

Window w(VideoMode(350,350,32), "Tic Tac Toe"); Event e1; const Input&
in1 = w.GetInput();

int main() {
    while(w.IsOpened())
    {
        w.Display();
    }
    return EXIT_SUCCESS;
}

Here is my .pro file:

INCLUDEPATH += C:\SFML-1.6\include
LIBS += C:\SFML-1.6\lib\sfml-system.lib \
    C:\SFML-1.6\lib\sfml-window.lib \
    C:\SFML-1.6\lib\sfml-graphics.lib \
    C:\SFML-1.6\lib\sfml-audio.lib \
    C:\SFML-1.6\lib\sfml-network.lib

Never in a million years did I imagine working with SFML on my favorite IDE is so difficult, what is the problem?

You should not use global object. They might mess up with SFML's internal.

Also you should process events. Not doing so might be the reason of your issue.

Try the example from the tutorial .

If you're discovering SFML for the first time I strongly suggest you start with 2.0 instead of the old, buggy and deprecated 1.6 version. Have a look at some discussions on the official forum to understand why 2.0 is better although it is currently "only" a release candidate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM