Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Linking SMFL Library to Qt on Windows machine
Qt 6.11 is out! See what's new in the release blog

Linking SMFL Library to Qt on Windows machine

Scheduled Pinned Locked Moved Installation and Deployment
14 Posts 3 Posters 9.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #3

    Well, it is a new project. I havent done anything yet.
    I am just following the tutorials on SMFL boards.

    My pro file at this point:

    @#-------------------------------------------------

    Project created by QtCreator 2011-08-21T19:06:23

    #-------------------------------------------------

    QT += core

    QT -= gui

    TARGET = game
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app

    SOURCES += main.cpp
    @

    and my cpp file

    @#include <SFML/Window.hpp>

    int main()
    {
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "GroundZero");

    // Start main loop
    bool Running = true;
    while (Running)
    {
        App.Display();
    }
    
    return EXIT_SUCCESS;
    

    }
    @

    best regards,

    GZ

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #4

      You need to add a "libs parameter":http://doc.qt.nokia.com/4.7/qmake-variable-reference.html#libs to your .pro

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #5

        Indeed, you need to link against your sfml libraries by adding a LIBS statement, like :

        @
        LIBS *= -L"path/to/your/SFML/libraries" -lsfml-graphics -lsfml-window -lsfml-system -lsfml-main
        @

        This may not be the exact libraries, but you get the idea ;)

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #6

          Yeah I see now thank you very much!!!

          Only 1 small problem... SFML 2.0 does not include .lib files... is that correct? all I can find is .h (header) files :)

          Thank you very much for your replies so far guys!

          EDIT:

          SFML\extlibs\libs-msvc\x86

          has some lib files but when i add those and press "RUN" it still asks for more lol. Ill try figuring it out if I cant solve it ill 'edit' this post :D

          1 Reply Last reply
          0
          • K Offline
            K Offline
            koahnig
            wrote on last edited by
            #7

            for including header files you can use "INCLUDEPATH ":http://doc.qt.nokia.com/4.7/qmake-variable-reference.html#includepath
            Is it a template library?
            Can you post a link to the source?

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #8

              yeah will do give me a couple of minutes please :)

              edit:

              :-1: error: cannot find -lsfml-freetype

              is the error I am receiving after doing:

              @LIBS *= -L"SFML/libs/" -lsfml-freetype -lsfml-glew -lsfml-jpeg -lsfml-openal32 -lsfml-sndfile@

              In my .pro file.

              The .lib files I included:

              http://img30.imageshack.us/img30/8214/unled2tw.png

              I downloaded this SFML : https://github.com/LaurentGomila/SFML/tarball/master
              The page it self is located here: http://www.sfml-dev.org/download.php -> SMFL 2.0 Snapshot

              My code at this moment:

              @#-------------------------------------------------

              Project created by QtCreator 2011-08-22T12:53:05

              #-------------------------------------------------

              QT += core gui

              TARGET = game
              TEMPLATE = app

              SOURCES += main.cpp

              HEADERS +=

              LIBS *= -L"SFML/libs/" -lsfml-freetype -lsfml-glew -lsfml-jpeg -lsfml-openal32 -lsfml-sndfile
              @

              and the .cpp file

              @#include <SFML/Window.hpp>

              int main()
              {
              // Create the main window
              sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

              // Start main loop
              bool Running = true;
              while (Running)
              {
                  App.Display();
              }
              
              return EXIT_SUCCESS;
              

              }
              @

              I also uploaded a copy of my whole directory incl. libs, .h and .cpp files here:
              http://uploading.com/files/96mdfac4/files.rar/

              I am using Microsoft Windows 7 Professional with Qt Creator :)

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #9

                You should link against .a libraries instead of .lib ones (located in libs-mingw)

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  koahnig
                  wrote on last edited by
                  #10

                  I guess octal is correct.
                  I have no experience with mingw on win7. I have visual studio installed there. On ubuntu I am using qt creator.

                  Vote the answer(s) that helped you to solve your issue(s)

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #11

                    Yeah I tried that... when i remove all .lib and paste the new files (.a) it still asks for -lsfml-freetype :P

                    1 Reply Last reply
                    0
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #12

                      Mhh yes, you're linking the wrong libraries, those are the dependancies needed to compile the SFML.

                      Since I've never used the SFML 2.0, you should follow the "official instructions":http://www.sfml-dev.org/tutorials/2.0/compile-with-cmake.php

                      1 Reply Last reply
                      0
                      • ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #13

                        Oke, will give that one a try :D thanks!!!
                        but...

                        set PATH=%PATH%;your_mingw_folder\bin
                        cmake

                        Cant find where to fill in that path and stuff... and where do i type in the command cmake?

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          koahnig
                          wrote on last edited by
                          #14

                          path is the environment variable path in your example. So with
                          @ set PATH=%PATH%;your_mingw_folder\bin@
                          you are extending that the path setting in your environment.
                          cmake you have to type on the command prompt.
                          [edit] Are you working on the command prompt?

                          Vote the answer(s) that helped you to solve your issue(s)

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved