Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Resolved] Problems to use the lib with QtCreator on Ubuntu  (Read 2542 times)

0 Members and 1 Guest are viewing this topic.

Naralas

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
[Resolved] Problems to use the lib with QtCreator on Ubuntu
« on: November 18, 2014, 11:09:49 am »
Hi,
I'm trying to include the lib on QtCreator but it doesn't work. If I install SFML with sudo apt-get install libsfml-dev I get the errors "undefined reference to...". If I install it "manually" I get the errors "cannot find lsfml-audio-d, lsfm-network-d,...". Here is my .pro file
QT       += core
QT       -= gui
TARGET = test_sfml
CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app

SOURCES += main.cpp

LIBS += -L"/home/ludo/SFML/lib"
CONFIG(release, debug|release): LIBS += -lsfml-audio -lsfml-graphics -lsfml-network -lsfml-window -lsfml-system
CONFIG(debug, debug|release): LIBS += -lsfml-audio-d -lsfml-graphics-d -lsfml-network-d -lsfml-window-d -lsfml-system-d
INCLUDEPATH += "/home/ludo/SFML/include"
DEPENDPATH += "/home/ludo/SFML/include"
 
If anyone could help me that would be great.
« Last Edit: November 20, 2014, 09:00:09 pm by Naralas »

SeriousITGuy

  • Full Member
  • ***
  • Posts: 123
  • Still learning...
    • View Profile
Re: Problems to use the lib with QtCreator on Ubuntu
« Reply #1 on: November 18, 2014, 03:23:20 pm »
Which version of Ubuntu do you use? Hopefully 14.04, as older versions had only SFML 1.6 in the official repos, since 14.04 Update 1, SFML 2.1 is in the repos.

When installing SFML via apt-get, it gets installed to /usr/, so normally you do not need to specify an additional include path for compiler and linker, as the gcc toolchain automatically searches in /usr/

What do you mean by installing it "manually"?
The normal manual installation method of SFML is by cloning from GitHub, and then building it yourself. This way it gets installed to /usr/local/, where the gcc toolchain also searches per default on Ubuntu 14.04.

I recommend you build it yourself from GitHub, cause the 2.1 version contains some linux specific bugs, which are ironed out in the git commits.

You can find a guide to this here

Naralas

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Problems to use the lib with QtCreator on Ubuntu
« Reply #2 on: November 19, 2014, 11:57:59 pm »
Im on Ubuntu 14.10 but as I said when I install it with the command apt-get install I can't use it, it keeps giving me the error "undefined reference".

SeriousITGuy

  • Full Member
  • ***
  • Posts: 123
  • Still learning...
    • View Profile
Re: Problems to use the lib with QtCreator on Ubuntu
« Reply #3 on: November 20, 2014, 10:03:26 am »
Ok, if you install SFML via apt it gets installed to /usr/lib /usr/bin /usr/include etc.
From your project file I can see you add some path from your home-directory to the additional include paths.
Are the *.so files from SFML located there?

Otherwise search for the lib files, they are called lib-sfml-system-d.so and so on.
When you found this path add it to your project settings.
Do not forget to also add the include files from SMFL to your project settings.

In Code::Blocks everything works out of the box when installing SFML via apt or building it manually.
Maybe consult help in the QtCreator forum for specific help on how to add libs to project settings.

Naralas

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Problems to use the lib with QtCreator on Ubuntu
« Reply #4 on: November 20, 2014, 08:59:41 pm »
Ok so I resintalled everything including cmake gcc compilator, etc.. and build it myself. Thanks for your help.

 

anything