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

Author Topic: SFML2 +QtCreator + MacOSX  (Read 3658 times)

0 Members and 1 Guest are viewing this topic.

prchakal

  • Full Member
  • ***
  • Posts: 142
    • View Profile
SFML2 +QtCreator + MacOSX
« on: April 20, 2012, 08:22:23 pm »
Hi,

Im making a little tutorial about configure SFML in all systems using QtCreator IDE and i want configure now with MACOSX.

Everything is OK when i build the project, i download the version RC for mac, extract to a path and link with my .pro and i compie with success.

But when i will run i got error:

Quote
dyld: Library not loaded: @executable_path/../Frameworks/libsfml-system.2.dylib
  Referenced from: /Users/paulo/Pessoal/workspaces/qt/sfml-project-build-desktop-Qt_4_8_1__gcc__Debug/sfml-project.app/Contents/MacOS/sfml-project
  Reason: image not found
Press <RETURN> to close this window...

I know that i need link the frameworks that come in the ZIP file for MAC but i dont know how to do it with mac, can anyone help me?

This is my .pro:

Quote
TEMPLATE = app
CONFIG += console
CONFIG -= qt

SOURCES += main.cpp

INCLUDEPATH += "/Users/paulo/Pessoal/downloads/cpp/sfml/dylibs/root/usr/local/include"
LIBS += -L"/Users/paulo/Pessoal/downloads/cpp/sfml/dylibs/root/usr/local/lib" \
    -lsfml-system \
    -lsfml-window \
    -lsfml-graphics \
    -lsfml-audio \
    -lsfml-network

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML2 +QtCreator + MacOSX
« Reply #1 on: April 20, 2012, 08:34:29 pm »
It's not the compilation/linking that is at fault but your installation of SFML : it cannot find libsfml-system.2.dylib.

Did you run the installer or did you follow "... with your bare hands" section of the tutorial ?
SFML / OS X developer

prchakal

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: SFML2 +QtCreator + MacOSX
« Reply #2 on: April 20, 2012, 08:45:42 pm »
Hi Hiura,

Yu are correct. After post here i try found the problem and correct, and if i copy the dylib files and all frameworks to "Frameworks" path in my build, it works.

Example:

My project when build, generate the path:

/Users/paulo/Pessoal/workspaces/qt/sfml-project-build-desktop-Qt_4_8_1__gcc__Debug/sfml-project.app/Contents/MacOS/
 
If i run the binary inside it, called: sfml-project , i get that error

So what i do? I have created a new directory:

/Users/paulo/Pessoal/workspaces/qt/sfml-project-build-desktop-Qt_4_8_1__gcc__Debug/sfml-project.app/Contents/Frameworks

And copy all this files to it:


SFML.framework             libsfml-graphics.2.0.dylib libsfml-network.2.dylib    libsfml-system.dylib       sfml-audio.framework       sfml-window.framework
libsfml-audio.2.0.dylib    libsfml-graphics.2.dylib   libsfml-network.dylib      libsfml-window.2.0.dylib   sfml-graphics.framework    sndfile.framework
libsfml-audio.2.dylib      libsfml-graphics.dylib     libsfml-system.2.0.dylib   libsfml-window.2.dylib     sfml-network.framework
libsfml-audio.dylib        libsfml-network.2.0.dylib  libsfml-system.2.dylib     libsfml-window.dylib       sfml-system.framework

And when i run the binary, it works!

But i need do it direct from QtCreator or link/auto-copy it to correct location.



Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML2 +QtCreator + MacOSX
« Reply #3 on: April 20, 2012, 08:50:25 pm »
I have no idea how QtCreator works so I won't be able to help you much. Maybe you can add a post-action shell script ?

However, you don't need to copy both dylibs and frameworks. Just choose one kind of binary. (There is more information in the tutorial about that.)
SFML / OS X developer

prchakal

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: SFML2 +QtCreator + MacOSX
« Reply #4 on: April 21, 2012, 08:44:51 am »
Hi.

I solve the problem. Thanks!

mizusajt

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: SFML2 +QtCreator + MacOSX
« Reply #5 on: May 03, 2012, 05:39:52 am »
What is the solution? Other people might have the same question. Like me.

prchakal

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: SFML2 +QtCreator + MacOSX
« Reply #6 on: May 03, 2012, 06:00:49 am »

mizusajt

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: SFML2 +QtCreator + MacOSX
« Reply #7 on: May 03, 2012, 06:22:42 am »
Thank you very much. Normally forums are frustrating in situations like this.

You are awesome.