Linking SMFL Library to Qt on Windows machine
-
You need to add a "libs parameter":http://doc.qt.nokia.com/4.7/qmake-variable-reference.html#libs to your .pro
-
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 ;)
-
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
-
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? -
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 SnapshotMy code at this moment:
@#-------------------------------------------------
Project created by QtCreator 2011-08-22T12:53:05
#-------------------------------------------------
QT += core gui
TARGET = game
TEMPLATE = appSOURCES += 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 :)
-
You should link against .a libraries instead of .lib ones (located in libs-mingw)
-
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. -
Yeah I tried that... when i remove all .lib and paste the new files (.a) it still asks for -lsfml-freetype :P
-
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
-
Oke, will give that one a try :D thanks!!!
but...set PATH=%PATH%;your_mingw_folder\bin
cmakeCant find where to fill in that path and stuff... and where do i type in the command cmake?
-
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?