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

Author Topic: Qt Creator + SFML on OSX Mavericks w/ clang  (Read 4120 times)

0 Members and 1 Guest are viewing this topic.

JayArby

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Qt Creator + SFML on OSX Mavericks w/ clang
« on: May 17, 2014, 03:37:07 am »
I am no expert with linking, so I may be doing something stupid, but anyways, I have a strange problem and cannot for the life of me make sense of it.

I am using Qt Creator on OSX Mavericks, compiling with clang. I am NOT using the Qt framework in my project; just using the IDE.

Most of SFML works as expected; however, for some strange reason, I cannot use Image::loadFromFile or Texture::loadFromFile or I get linking errors (Undefined symbols for architecture x86_64). I have compiled and recompiled SFML and tried everything I can think of. I can compile SFML apps via command line, but not within Qt Creator. Does anyone know what the issue might be?

The compiler output is:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.6 -o test.app/Contents/MacOS/test main.o   -L/usr/local/lib -lsfml-audio-d -lsfml-graphics-d -lsfml-network-d -lsfml-window-d -lsfml-system-d
Undefined symbols for architecture x86_64:
  "sf::Image::loadFromFile(std::string const&)", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [test.app/Contents/MacOS/test] Error 1
21:30:14: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project test (kit: Desktop Qt 5.2.1 clang 64bit)
When executing step 'Make'

This is frustrating me. Thanks people.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
SFML / OS X developer

JayArby

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: Qt Creator + SFML on OSX Mavericks w/ clang
« Reply #2 on: May 17, 2014, 09:03:59 pm »
Okay, I will try compiling as directed in that tutorial. However, the problem is still not clear to me; are you saying that Qt Creator is using the wrong compiler? If so, shouldn't I be able to simply change the compiler it is using?

JayArby

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: Qt Creator + SFML on OSX Mavericks w/ clang
« Reply #3 on: May 17, 2014, 09:05:55 pm »
Ah, or are you saying that SFML is by default configured to compile for Xcode with the C++11 compiler and Qt Creator isn't?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Qt Creator + SFML on OSX Mavericks w/ clang
« Reply #4 on: May 17, 2014, 10:09:49 pm »
No, what I say is the following: your SFML binaries and your project are not compiled with the same settings.

You can configure QtC to use the same settings as your SFML binaries – or – recompile SFML with your project settings.
SFML / OS X developer

JayArby

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: Qt Creator + SFML on OSX Mavericks w/ clang
« Reply #5 on: May 17, 2014, 11:02:20 pm »
Well ultimately I want to link with the Qt framework, so I'll probably stick with whatever it was compiled with. Do you know specifically what settings are in conflict?

JayArby

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: Qt Creator + SFML on OSX Mavericks w/ clang
« Reply #6 on: May 17, 2014, 11:03:51 pm »
I'll just try specifying the compilers in CMake as shown in the tutorial and see if that works.

 

anything