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

Author Topic: error undefined symbol x86_64 only for saveToFile() on osX ?  (Read 1666 times)

0 Members and 1 Guest are viewing this topic.

template

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
error undefined symbol x86_64 only for saveToFile() on osX ?
« on: August 27, 2014, 07:07:36 pm »
My config : OS X.9.4, SFML-2.1-osx-clang-universal

In a program having making lots of references to other sgml sound objects, when I uncomment the line "mySoundBuffer.saveToFile(theName.str());" I'm getting the error message
Undefined symbols for architecture x86_64:
  "sf::SoundBuffer::saveToFile(std::string const&) const", referenced from:
      soundSauv::generate() in soundSauv.o
Otherwise it does compile well with the rest of the app.

in the .pro file was put the following :
LIBS += -L"/usr/local/lib"

CONFIG(release, debug|release): LIBS += -lsfml-audio -lsfml-graphics -lsfml-system -lsfml-network -lsfml-window
CONFIG(debug, debug|release): LIBS += -lsfml-audio -lsfml-graphics -lsfml-system -lsfml-network -lsfml-window

INCLUDEPATH += "/usr/local/include/"
DEPENDPATH += "/usr/local/include/"

Thanks

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: error undefined symbol x86_64 only for saveToFile() on osX ?
« Reply #1 on: August 27, 2014, 07:29:31 pm »
You're probably compiling with gcc and/or using a different std lib than the one used to compiled SFML. Reread the red part of the tutorial for OS X or search the forum for similar errors.
SFML / OS X developer

template

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: error undefined symbol x86_64 only for saveToFile() on osX ?
« Reply #2 on: August 27, 2014, 10:00:50 pm »

I did not find a similar error, with just one of the SFML functions causing trouble and not the others. Did you ?

Well, did I omit to mention that I used Qt as an IDE ? The tutorial for OSX takes care of the Xcode approach which I have tried and succeeded in using, but not within Qt.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: error undefined symbol x86_64 only for saveToFile() on osX ?
« Reply #3 on: August 27, 2014, 10:10:07 pm »
If you look for 'Undefined symbols for architecture x86_64' you'll find plenty of threads about this issue. It's not about this specific function but the presence of std::string in the function signature.

Whether you use Xcode, Makefiles, Qt IDE or anything else, the problem is the same: don't mix compiler / std lib. The explanation in the tutorial is not Xcode specific but you need to know how to configure your tools accordingly. In your case you need to use clang and libc++ since you've downloaded SFML-2.1-osx-clang-universal.
SFML / OS X developer

template

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: error undefined symbol x86_64 only for saveToFile() on osX ?
« Reply #4 on: August 28, 2014, 12:51:53 am »
Thank you. May be there is a bit not enough understanding from my part concerning clang and libc++ configuration.
Do you think I shall recompile the SFML lib from inside Qt ?

Talking about an osx tutorial, do you mean this page : http://sfml-dev.org/tutorials/2.1/start-osx.php ?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: error undefined symbol x86_64 only for saveToFile() on osX ?
« Reply #5 on: September 02, 2014, 09:59:57 am »
Yes, that's the tutorial I'm talking about. You need to figure out which compiler you're using and with which stl impl. Then you might need to recompile SFML depending on your settings if they don't match the ones from the downloadable SDKs.
SFML / OS X developer