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

Author Topic: Installing SFML on Mac (Sierra), XCode (Command line tools only)  (Read 3982 times)

0 Members and 2 Guests are viewing this topic.

TueJoshua

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
UPDATE: I've realized that I put this thread in the "non-help" section by mistake.

If there's a way to move the thread or there's something else that should be done, please let me know :)

=============================

I'm trying to install for use with XCode command line C++ tools.

I've followed the guide at https://www.sfml-dev.org/tutorials/2.4/start-osx.php
- Copied frameworks, not dylibs
- Not copied the (optional) templates

I haven't been able to use the "Create your first SFML program" as I only have command line tools (and not the "whole" Xcode) installed.
I've tried compiling the "Pong" example included in the SFML download as well as my own code, simply trying to open a sf::RenderWindow (copied the statement from one of the examples).
Whatever I do, I always get the same "Undefined symbols for architecture x86_64" error message.
This includes trying to follow https://stackoverflow.com/questions/14228856/how-to-compile-c-with-c11-support-in-mac-terminal, which I tried as a result of the comment "If you downloaded the "Clang" version from the download page, you should select C++11 with Clang and libc++."

Any tips?

Verbose output when trying to compile (the example) Pong.cpp - see attached.
« Last Edit: August 28, 2017, 01:53:45 pm by TueJoshua »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Installing SFML on Mac (Sierra), XCode (Command line tools only)
« Reply #1 on: August 29, 2017, 07:14:41 pm »
You need to link against SFML with the `-framework` option.
SFML / OS X developer

TueJoshua

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Installing SFML on Mac (Sierra), XCode (Command line tools only)
« Reply #2 on: September 01, 2017, 03:47:12 pm »
Tried adding "-framework SFML" to the parameter list, I get the exact same result

(If I try "-framework SFM", I get an additional warning that the .framework file is not found, so it does connect to the framework file...)

Any further suggestions?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Installing SFML on Mac (Sierra), XCode (Command line tools only)
« Reply #3 on: September 01, 2017, 03:51:16 pm »
Yes. The frameworks you need to link have the same name as the dylibs: -framework sfml-audio -framework sfml-system .... SFML.framework only contains header files.
SFML / OS X developer

TueJoshua

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Installing SFML on Mac (Sierra), XCode (Command line tools only)
« Reply #4 on: September 06, 2017, 10:24:47 am »
Thanks, that worked!

(technically, the dylibs (which I haven't installed) have different names, e.g. "libsfml-audio.dylib" - it's the framework file names you want (which are in fact "sfml-audio" etc.)

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Installing SFML on Mac (Sierra), XCode (Command line tools only)
« Reply #5 on: September 06, 2017, 11:06:35 am »
I meant it's the same command except using -framework instead of -l. The linker resolves the lib prefix and .dylib postfix. Anyway, glad you got it working; have fun now!
SFML / OS X developer

 

anything