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

Author Topic: SFML on a Mac using gcc instead of xcode  (Read 4695 times)

0 Members and 1 Guest are viewing this topic.

Dig

  • Newbie
  • *
  • Posts: 31
    • View Profile
SFML on a Mac using gcc instead of xcode
« on: April 19, 2009, 07:22:05 am »
Is this possible, or is there another good solution to development on a Mac.  Basically I'm using Netbeans for the Windows and Linux ports of my project and would love to be able to use NetBeans for the Mac port to keep everything as similar as possible.

I'm making some progress I think, but I'm drowning in dependency hell trying to get it to link properly.  I think the amount of errors relating to Cocoa mean I'm missing something critical.

Code: [Select]
Undefined symbols:
  "sf::priv::WindowImplCocoa::WindowImplCocoa(void*, sf::WindowSettings&)", referenced from:
      sf::priv::WindowImpl::New(void*, sf::WindowSettings&)in libsfml-window-s.a(WindowImpl.o)
  "_CGDisplayCurrentMode", referenced from:
      sf::priv::VideoModeSupport::GetDesktopVideoMode()     in libsfml-window-s.a(VideoModeSupport.o)
  "_CFArrayGetCount", referenced from:
      sf::priv::VideoModeSupport::GetSupportedVideoModes(std::vector<sf::VideoMode, std::allocator<sf::VideoMode> >&)in libsfml-window-s.a(VideoModeSupport.o)
  "_CFDictionaryGetValue", referenced from:
      sf::priv::VideoModeSupport::GetDesktopVideoMode()     in libsfml-window-s.a(VideoModeSupport.o)
      sf::priv::VideoModeSupport::GetDesktopVideoMode()     in libsfml-window-s.a(VideoModeSupport.o)
      sf::priv::VideoModeSupport::GetDesktopVideoMode()     in libsfml-window-s.a(VideoModeSupport.o)
      sf::priv::VideoModeSupport::GetSupportedVideoModes(std::vector<sf::VideoMode, std::allocator<sf::VideoMode> >&)in libsfml-window-s.a(VideoModeSupport.o)
      sf::priv::VideoModeSupport::GetSupportedVideoModes(std::vector<sf::VideoMode, std::allocator<sf::VideoMode> >&)in libsfml-window-s.a(VideoModeSupport.o)
      sf::priv::VideoModeSupport::GetSupportedVideoModes(std::vector<sf::VideoMode, std::allocator<sf::VideoMode> >&)in libsfml-window-s.a(VideoModeSupport.o)


Any ideas?

Cheers,
Nick

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
SFML on a Mac using gcc instead of xcode
« Reply #1 on: April 19, 2009, 01:36:20 pm »
Which libraries do you link to your executable ?

And by the way I can read "libsfml-window-s.a", where does this library come from ? Did you build your own static libraries ?
Want to play movies in your SFML application? Check out sfeMovie!

Dig

  • Newbie
  • *
  • Posts: 31
    • View Profile
SFML on a Mac using gcc instead of xcode
« Reply #2 on: April 21, 2009, 12:16:17 am »
Oh yes,

I forgot I'd done that, I built static libraries from the Linux sources.  Maybe it doesn't work like that!

I'm new to the Mac in case that wasn't apparent.  I'm not clear on how dynamic libraries work in that environment and was using static libs on the PC and Linux versions so rebuilt them on the Mac.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
SFML on a Mac using gcc instead of xcode
« Reply #3 on: April 21, 2009, 08:30:34 pm »
Indeed, it won't work. Mac OS X has its own window implementation named Cocoa whereas the Linux implementation uses X Window.

I did not even know one could build the SFML libraries through the makefiles (they don't include Mac OS X support), and I've been trying right now and I got failure message.

Dynamic library in the Mac OS X environment work the same way as in the Linux's one.

What OS are you used to ?
Want to play movies in your SFML application? Check out sfeMovie!

Dig

  • Newbie
  • *
  • Posts: 31
    • View Profile
SFML on a Mac using gcc instead of xcode
« Reply #4 on: April 23, 2009, 11:37:35 pm »
I've built the static libs in Linux and got it working and windows under MingW and got it working.

When I was first trying to us the prebuilt Mac OS X binaries I got errors regarding dynlib? (or something) files so I think I got side tracked down a different path trying to avoid them.  (There is a Cocoa folder in the Window package, I included that by editing makefiles and got it to compile, but obviously not link!)

If we can forget the mess I've got into is it possible to compile an SFML project using gcc and not xcode's framework system?  If not I'll struggle through with xcode and its quirky editing features.

Cheers,
Nick

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
SFML on a Mac using gcc instead of xcode
« Reply #5 on: April 24, 2009, 02:40:06 am »
Frameworks are not related to Xcode.
To use them with gcc, instead of -lyour_library_name, type -framework your_framework_name (-Fdir_name option to add framework search directory instead of -Ldir_name for libraries).
Want to play movies in your SFML application? Check out sfeMovie!

Dig

  • Newbie
  • *
  • Posts: 31
    • View Profile
SFML on a Mac using gcc instead of xcode
« Reply #6 on: April 26, 2009, 10:42:01 pm »
Oh, well thats nice and easy!  I'll give it a go.

Cheers,
Nick

Dig

  • Newbie
  • *
  • Posts: 31
    • View Profile
SFML on a Mac using gcc instead of xcode
« Reply #7 on: April 28, 2009, 06:04:19 am »
and it works and is similar enough to my Windows and Linux code to be easy to maintain.

Thanks for your help.

Cheers,
Nick

 

anything