Using sfml library within QTCreator in windows

This is a quick post to show how to use the sfml library within our beloved QTCreator. The sfml library is a very clean, cross-platform and easy to use library for windowing, opengl, networking, audio and more. Check it out it’s really good.

It turns out it’s really easy to start playing with sfml, which one of the reasons why everyone loves it.

  1. First download the appropriate version from here (I downloaded the Windows – MinGW code::blocks version which works perfectly with the QTCreator/MinGW compiler)
  2. Extract the file archive to a directory, for example the C:\SFML
    1. Make sure that the directory you extract it to has no spaces in it, as that could be a problem with QTCreator.
  3. Copy dlls from the SFML\lib directory to C:\Windows\system32 directory for the 32-bit version of Windows or to the C:\Windows\SYSWOW64 director for the 64-bit version of Windows.  You could also just copy the dlls to your executable directory.
    1. You don’t have to copy all the dlls, but just the ones you need. For example if you just use the system library, you could just copy the sfml-system.dll for the release version and/or the sfml-system-d.dll for the debug version.
  4. Finally, you just have to add the paths to the project file as so:
    INCLUDEPATH += C:\SFML\include
    LIBS += C:\SFML\lib\libsfml-system.a \
        C:\SFML\lib\libsfml-window.a \
        C:\SFML\lib\libsfml-graphics.a \
        C:\SFML\lib\libsfml-audio.a \
        C:\SFML\lib\libsfml-network.a
    

That’s it. Now download sfml and get creating 🙂

About Vincenzo Barbato

Known to his friends as Enzo, he's an outside-the-box engineer/researcher whose interests and expertise span many fields, including controls systems, multi-physics simulations, mechatronics, oil technologies, data analysis and machine vision just to name a few.

Refusing to grow up, he's on a continuous journey to develop simple and creative solutions that have the power of disrupting industries by optimizing systems and processes.

Married to a beautiful wife, with two beautiful daughters and two identical twin boys, his home is a never ending chaotic fountain of inspiration.

His outlook on life:

"Never blindly accept what you're told, listen, but then question, with curiosity, creativity and collaboration we can change the world"

About Enzo

Known to his friends as Enzo, he's an outside-the-box engineer/researcher whose interests and expertise span many fields, including controls systems, multi-physics simulations, mechatronics, oil technologies, data analysis and machine vision just to name a few. Refusing to grow up, he's on a continuous journey to develop simple and creative solutions that have the power of disrupting industries by optimizing systems and processes. Married to a beautiful wife, with two beautiful daughters and two identical twin boys, his home is a never ending chaotic fountain of inspiration. His outlook on life: "Never blindly accept what you're told, listen, but then question, with curiosity, creativity and collaboration we can change the world"

Leave a Reply

Your email address will not be published. Required fields are marked *