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

Author Topic: Mac OS X 10.6.8 SFML 2.0  (Read 7110 times)

0 Members and 1 Guest are viewing this topic.

Jeffrey

  • Newbie
  • *
  • Posts: 36
    • View Profile
Mac OS X 10.6.8 SFML 2.0
« on: July 22, 2012, 04:44:27 am »
I read the installation tutorial about SFML 2.0 and it says that you need XCode preferably the fourth version. I was wondering what does that exactly means. Can I use the installer also for the latest version of XCode 3? I can't install the 4 because I don't want to upgrade to Lion (actually I just downgraded back to Snow Leopard).

Also is there any other way to use SFML without XCode? Maybe with Code Blocks for Mac?

Thanks.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Mac OS X 10.6.8 SFML 2.0
« Reply #1 on: July 22, 2012, 09:35:44 am »
You are absolutely free to use any IDE or command line tool you want, of course. You just need to know how to link against a library (not specifically SFML since it's always the same operation) with the tool you chose to use.

Now, if you don't have Xcode 4 you can't benefit from the project templates. But that's it.
Quote from: tutorial
Be aware that these templates are not compatible with Xcode 3. If you are still using this version of the IDE and you are not considering updating your tool then you can still, of course, create SFML-based applications, however, we will not discuss here how you can do that. Please refer to Apple's documentation about Xcode 3 and how to add a library to your project.
SFML / OS X developer

Jeffrey

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Mac OS X 10.6.8 SFML 2.0
« Reply #2 on: July 22, 2012, 04:23:09 pm »
Thanks for your answer. Let's say Iìd like to do this from the Terminal. How can I link all the files of the library? Thanks.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Mac OS X 10.6.8 SFML 2.0
« Reply #3 on: July 22, 2012, 04:33:38 pm »
If you only want a classic binary (i.e., you don't want an application bundle) then you can do pretty much like on any Unix :
g++ main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system
if you use dylibs or
g++ main.o -o sfml-app -framework sfml-graphics -framework sfml-window -framework sfml-system
if you use frameworks.
SFML / OS X developer

Jeffrey

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Mac OS X 10.6.8 SFML 2.0
« Reply #4 on: July 22, 2012, 04:54:30 pm »
Sorry, could you please explain me step by step how to be able to compile like that? Do I have to download the source code? Do I have to install something? Where do I put my main.cpp file? What folder is that command referred to?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Mac OS X 10.6.8 SFML 2.0
« Reply #5 on: July 22, 2012, 07:11:03 pm »

Ok, so you should read Introduction and Installing SFML ... from Tutorial - Getting started - SFML and Xcode (Mac OS X), then read Compiling a SFML program from Tutorial - Getting started - SFML and Linux to get an idea of how compilation work.

Now, it's very important to know what are a compiler and a linker. Wikipedia should give you a start : http://en.wikipedia.org/wiki/Compiler and http://en.wikipedia.org/wiki/Linker_(computing). (Don't go too deep in the details, you only to know how they work together.)

Except the link step, it is the same as compiling a program that doesn't require any external library.
SFML / OS X developer

Jeffrey

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Mac OS X 10.6.8 SFML 2.0
« Reply #6 on: July 22, 2012, 08:27:51 pm »
Thanks, I followed the tutorial which basically brought me to follow the Code::Block IDE tutorial. I followed the steps. I added the include folder in the compiler and the lib folder in the linker. I linked in the linker settings:

Quote
-lsfml-system

But now when I try to run the test source code I get:

Quote
-------------- Build: Debug in Test ---------------

Linking console executable: bin/Debug/Test
ld: library not found for -lsfml-system
collect2: ld returned 1 exit status

What have I missed?
« Last Edit: July 22, 2012, 08:35:23 pm by Jeffrey »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Mac OS X 10.6.8 SFML 2.0
« Reply #7 on: July 22, 2012, 08:32:27 pm »
You're mixing header files and binary versions somehow. Probably because you have more than one version installed on your computer.

(With SFML 2.0, functions start with a lower case letter. You can use this property to identify the old headers from the new one easily.)
SFML / OS X developer

Jeffrey

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Mac OS X 10.6.8 SFML 2.0
« Reply #8 on: July 22, 2012, 08:34:44 pm »
I tried installing SFML 1.6 and I've edited my previous post, please, take a look. The previous error was because I didn't set the linker settings.
Thanks.

PS: I'm following this: http://www.sfml-dev.org/tutorials/1.6/start-cb.php
« Last Edit: July 22, 2012, 08:37:11 pm by Jeffrey »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Mac OS X 10.6.8 SFML 2.0
« Reply #9 on: July 22, 2012, 08:36:56 pm »
I'm lost, now you're using 1.6 or 2.0 ?
SFML / OS X developer

Jeffrey

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Mac OS X 10.6.8 SFML 2.0
« Reply #10 on: July 22, 2012, 08:37:30 pm »
I've decided to use SFML 1.6.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Mac OS X 10.6.8 SFML 2.0
« Reply #11 on: July 22, 2012, 08:43:04 pm »
I can only recommend you to use 2.0 (1.6 is way more buggy that 2.0 for one thing, and also slower, and not maintained since a long time now). But it's your call.

Anyway, if you're using 1.6 you can use Xcode 3 as described in the dedicated tutorial since you don't use the terminal anymore. Also the error you get let me thing something was not installed correctly. The tutorial should help you with that.
SFML / OS X developer

Jeffrey

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Mac OS X 10.6.8 SFML 2.0
« Reply #12 on: July 22, 2012, 08:49:34 pm »
Ok, now it's getting confusing. I decided to use 1.6 because I thought 2.0 was still in some kind of beta version and was still buggy. But if you tell me the opposite I guess I should go back on deciding for 2.0 again.

I'm sorry for the confusion. So I'll try to follow this tutorial for CodeBlocks on Windows for SFML 2.0: http://www.sfml-dev.org/tutorials/2.0/start-cb.php
Is there anything that I should change in that tutorial to make it work on my Mac too? (Considering that I'm using Mac OS X)

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Mac OS X 10.6.8 SFML 2.0
« Reply #13 on: July 22, 2012, 09:00:06 pm »
Ok, now it's getting confusing. I decided to use 1.6 because I thought 2.0 was still in some kind of beta version and was still buggy.
Yes, this is a little paradoxal : SFML 2.0 RC is not the "stable" version yet but is already less buggy than 1.6, it's the release candidate which means nothing will change in the API until the 2.0 stable version.

Is there anything that I should change in that tutorial to make it work on my Mac too? (Considering that I'm using Mac OS X)
So you have to do one thing before following this tutorial : install SFML for Mac with the installer. Then you have to use /usr/local/include and /usr/local/lib for the search directories. Also you can't use the static version as it doesn't exist on Mac. That's should do the trick.

Let me know if you still have some issues.
SFML / OS X developer

Jeffrey

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Mac OS X 10.6.8 SFML 2.0
« Reply #14 on: July 22, 2012, 10:43:02 pm »
Now I get:


Quote
-------------- Build: Debug in Test ---------------

Compiling: main.cpp
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp: In function 'int main()':
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:6: error: 'Text' is not a member of 'sf'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:6: error: expected `;' before 'text'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:8: error: 'class sf::RenderWindow' has no member named 'isOpen'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:11: error: 'class sf::RenderWindow' has no member named 'pollEvent'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:13: error: 'class sf::Event' has no member named 'type'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:14: error: 'class sf::RenderWindow' has no member named 'close'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:17: error: 'class sf::RenderWindow' has no member named 'clear'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:18: error: 'class sf::RenderWindow' has no member named 'draw'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:18: error: 'text' was not declared in this scope
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:19: error: 'class sf::RenderWindow' has no member named 'display'

I've installed by the 2.0 installer for mac, linked those folders you said (copied and pasted it) in Code::blocks, under build options > Linker settings I've added sfml-graphics, sfml-window, sfml-system and tried to run the sample code.

:(