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

Author Topic: All kinds of errors getting SFML 2 to run in Xcode, would appreciate some help.  (Read 8381 times)

0 Members and 1 Guest are viewing this topic.

esotericsean

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://seanduran.com
Hey everyone,

Really appreciate any help with this. I used to have 1.6 running in Code::Blocks back in the day. Now I have a Mac and am learning Xcode. I don't remember SFML being this complicated to install and get running, although I'm not the great programmer. Here is everything I did, please let me know where I went wrong:

1. Downloaded the latest FML 2.0 Source and "compiled" it with CMake and Xcode. Everything looked like it was successful. I used the CMake GUI.

2. Transferred the SFML templates into the correct folder and created a new SFML Project (C++98 with GCC and libstd++ and target 10.5).

3. Try to build and get the following errors:


4. I've messed with build settings, linker settings, etc. but can't seem to figure out what exactly is wrong.

eigenbom

  • Full Member
  • ***
  • Posts: 228
    • View Profile
I always stumble on issues when building the mac version of my game. I always forget that on osx you have to compile for Unix target and explicitly specify the clang compiler to build the libs. I'm not sure if that's what's causing your problem though.

esotericsean

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://seanduran.com
I might have built for Xcode. Let me try that.

esotericsean

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://seanduran.com
Okay, so I used CMake and checked Unix Makefiles and specified the native compilers for C and C++ (/usr/bin/clang and /usr/bin/clang++, respectively).

This time, it didn't generate a project file for me to compile using Xcode. Instead, it generated a folder that looks like this:



No clue what to do next. Doesn't look like there are any files for me to actually compile.

eigenbom

  • Full Member
  • ***
  • Posts: 228
    • View Profile
There are pre-built binaries, so you don't have to compile it yourself! See http://sfml-dev.org/tutorials/2.0/start-osx.php

But if you want to, then you can continue the process: open the Terminal, cd to that dir, and type "make install"
see here: http://sfml-dev.org/tutorials/2.0/compile-with-cmake.php

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
as said by eigenbom, you don't need to compile SFML 2.0 yourself.. just download the binaries and follow the tutorials.

if you really want to compile it, read carefully the tutorial on cmake; it explicitly states that you should not attempt to compile SFML with Xcode but use Makefile instead.
SFML / OS X developer

esotericsean

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://seanduran.com
Thanks guys,

I was finally able to successfully compile it using Makefile. But projects still won't run by default in Xcode. Do I need to change the linker settings?

Here are the errors I'm getting: http://i.imgur.com/i6P3OjD.jpg

eigenbom

  • Full Member
  • ***
  • Posts: 228
    • View Profile
I remember I also had to change (in xcode build settings) from "standard c++ library" to "libstdc++" or some nonsense. Sorry I can't be of more help, I only ever build on mac once every 6 months. Good luck!

esotericsean

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://seanduran.com
I'll keep trying, thanks for your time.

Almost ready to give up on SFML and try something else. It's a shame, I really loved 1.6 and want to try working with 2.0

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
That statement is absolutely unfair ! The tutorial explicitly states how you have to set up the compiler flag to use clang/libc++ in your project. You clearly didn't read the documentation..

PLUS we provide already compiled binaries with some Xcode templates to ease the installation and creation of new projects.....
SFML / OS X developer

esotericsean

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://seanduran.com
I'm sorry Hiura, I know you've put in a lot of work on this. I won't give up. :)

I'm not an expert programmer (my main job is video production), so the directions in the tutorial are hard for me to follow because I don't understand what all of it means. I have read it very thoroughly, several times, but I'm still having trouble.

I've tried both the already compiled binaries and also compiling them myself, both times I've run into linker errors. It works for some people, so I know that I'm doing something wrong -- I'm trying to take it step by step and figure it out.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Quote
I'm not an expert programmer (my main job is video production), so the directions in the tutorial are hard for me to follow because I don't understand what all of it means.
Keep in mind that this is not our job to explain how to use your programming tools. And don't blame SFML for that, try to find good XCode tutorials instead :P
Laurent Gomila - SFML developer

Cornstalks

  • Full Member
  • ***
  • Posts: 180
    • View Profile
    • My Website
I've tried both the already compiled binaries and also compiling them myself, both times I've run into linker errors. It works for some people, so I know that I'm doing something wrong -- I'm trying to take it step by step and figure it out.
I think the official tutorials are great, but in case it helps, I've got a short tutorial on building SFML 2 with Clang (and libc++) for C++11. Perhaps yet another resource might help just a little. If you do use my little tutorial, make sure that:

You have OS X 10.8.3
You have Xcode 4.6.2
Your system is all up to date
Your command line tools are up to date (Xcode -> Preferences -> Downloads will tell you if you need to download & install them (or update them)).
You pay very close attention to the last image in my tutorial and set everything exactly as I show it (of course, "Product Name," "Organization Name," and "Company Identifier" may be different).

esotericsean

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://seanduran.com
Thanks so much, Cornstalks!

Followed your tutorial to the tee, but I'm getting one error: "Shell Script Invocation Error, Command /bin/sh failed with exit code 2"

Here's a screenshot: http://i.imgur.com/LGyLchh.jpg

Any idea what that means? Thanks!

* * *

BTW, Laurent I know it's not your job to help me. Which is why I'm posting in your public forums for help, where hopefully other users can chime in. I understand if you personally don't have time. Appreciate it, though!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Quote
BTW, Laurent I know it's not your job to help me. Which is why I'm posting in your public forums for help, where hopefully other users can chime in. I understand if you personally don't have time.
I like to help as much as I can on the forum, that was not my point. My point is that you shouldn't focus only on SFML and its tutorials if you don't know how to configure your projects, searching more general tutorials about XCode and how to link libraries could be helpful too -- and not only for SFML, but for all other libraries that you'll have to use in the future.
Laurent Gomila - SFML developer

 

anything