How to use SFML with Qt Creator?



  • NOTE: I didn't know whether or not to put this in Game Dev section, because SFML is usually for games (from what I've heard), but I put it here, since the question is based on using the libs with the IDE.

    With that out of the way, onto the question. I got SFML (the mingw version) earlier, extracted the file, and put it in the "Tools" subfolder in Qt directory (it is with the QtCreator folder and mingw48_32 folder). What do I do now? Can I even use SFML with Qt? Also, please be as clear as possible. I am in a lazy mood today and don't feel like reading gibberish.

    Any help == Great appreciation

    Oh, and here is the link to the downloads, if it helps.
    "Download Link":http://www.sfml-dev.org/download.php


  • Moderators

    Can you clarify? Do you mean you want to mix SFML with Qt (the library) or use it in Qt Creator (the IDE) without Qt?

    If it's the former then which features exactly do you need? Qt has its own event loop and I don't know SFML, but I suspect it has its own too? Some of the features might be compatible (like QString) and others might not (like the widgets). It all depends on which features from these libs do you need, because they in many ways overlap the same functionality. I suspect SFML offers a very limited subset of what Qt can do.

    If it's the latter then you use it like any other external library: edit your .pro file and add SFML headers location to INCLUDEPATH, .lib (or .a in case of MinGW) to the LIBS and (if linking dynamically) put the dlls in the output folder.

    Also, don't put custom libraries in Qt installations folders.
    It's like putting it in C:\Program Files\Adobe\Reader...
    I mean you can, but it's not the best idea.



  • Well, I am going to start game development (learning it) and SFML is what I am going with. I want to use it in the IDE, not the QML. So, just a regular C++ project. THanks for the answer. And just saying, I did mention the Qt Creator in the question, in case you missed it.


  • Moderators

    You did, but then you asked "Can I even use SFML with Qt?" so...
    And then you say "I want to use it in the IDE, not the QML" and it's like saying "I want to use it in the notepad, not the python" so you seem to be mixing some stuff.

    Anyway, best of luck. There shouldn't be a problem with using SFML in a qt-less program.
    Just remember to add QT -= core in the .pro file so that the linker won't try to link to Qt libraries.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.