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

Author Topic: SFML from Command Line Mac OS X  (Read 4444 times)

0 Members and 1 Guest are viewing this topic.

Noegddgeon

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • Soundcloud
SFML from Command Line Mac OS X
« on: October 02, 2009, 09:42:52 am »
Hello, everybody. I tried getting SFML to work on my Macbook with OS 10.5 running, however it would not work with XCode for reasons that Ceylo explained had to be related to me not installing the code properly. I was wondering if anyone could explain to me how I could compile a .cpp file using SFML from the Command Line. I know how to compile straight C++ code like this:

c++ sfmltest1.cpp -o sfmltest

I tried making a program with Allegro and there was something I had to add at the end after that to link it with the library (forgot what it was, though). Anyways, I would appreciate help in this very much. :]

Colton
Whether you think you can or you can't, you're right.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
SFML from Command Line Mac OS X
« Reply #1 on: October 02, 2009, 11:09:01 am »
To link with SFML you need to use its frameworks. With G[cc|++] use the -framework option. (Type man g++ to know more about it.)
SFML / OS X developer

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
SFML from Command Line Mac OS X
« Reply #2 on: October 02, 2009, 01:05:46 pm »
Hiura is right. For example to link with the System package, look at the name of the framework and drop the extension => the option to link against this framework will be "-framework sfml-system".

One more point for the users that may read this answer. If you're running Mac OS X 10.6, the default output architecture of gcc/g++ is Intel 64 bits (x86_64), but the SFML frameworks are (for now) only built for PowerPC 32 bits (ppc) and Intel 32 bits (i386). Thus in order to use the frameworks, you must compile the sources with the same architecture (ie. ppc or i386). To do so, add the option "-arch i386" or "-arch ppc" at compile time.

In the current example, it would give the following command line:
Code: [Select]
g++ sfmltest1.cpp -o sfmltest -arch i386 -framework sfml-system
Want to play movies in your SFML application? Check out sfeMovie!

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
SFML from Command Line Mac OS X
« Reply #3 on: October 02, 2009, 06:15:20 pm »
Ceylo, I think ppc is no more supported by 10.6.
SFML / OS X developer

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
SFML from Command Line Mac OS X
« Reply #4 on: October 02, 2009, 06:16:59 pm »
Mac OS X 10.6 can no more run on PowerPC Macs but PowerPC applications can still run on it (Rosetta is still provided).
Want to play movies in your SFML application? Check out sfeMovie!

 

anything