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

Author Topic: xcode projects will not compile (link)  (Read 4187 times)

0 Members and 1 Guest are viewing this topic.

joseph90

  • Newbie
  • *
  • Posts: 5
    • View Profile
xcode projects will not compile (link)
« on: September 27, 2013, 11:55:33 am »
Hi,
Downloaded sfml 2.1 but xcode project will not compile.
I am using xcode 4 on osx 10.6.8

I get 5 linker errors all like the following

Ld /Users/josephkehoe/Library/Developer/Xcode/DerivedData/test-dyvrrygwjxvjqhcerziipthgmbwq/Build/Products/Debug/test.app/Contents/MacOS/test normal i386
    cd /Users/josephkehoe/Desktop/SFML/test
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    /Developer/usr/bin/clang++ -arch i386 -L/Users/josephkehoe/Library/Developer/Xcode/DerivedData/test-dyvrrygwjxvjqhcerziipthgmbwq/Build/Products/Debug -L/usr/local/lib -F/Users/josephkehoe/Library/Developer/Xcode/DerivedData/test-dyvrrygwjxvjqhcerziipthgmbwq/Build/Products/Debug -F/Library/Frameworks -filelist /Users/josephkehoe/Library/Developer/Xcode/DerivedData/test-dyvrrygwjxvjqhcerziipthgmbwq/Build/Intermediates/test.build/Debug/test.build/Objects-normal/i386/test.LinkFileList -mmacosx-version-min=10.6 -framework sfml-system -framework sfml-window -framework sfml-graphics -framework sfml-audio -framework sfml-network -framework sfml-system -framework sfml-window -framework sfml-graphics -framework sfml-audio -framework sfml-network -framework SFML -o /Users/josephkehoe/Library/Developer/Xcode/DerivedData/test-dyvrrygwjxvjqhcerziipthgmbwq/Build/Products/Debug/test.app/Contents/MacOS/test

Undefined symbols for architecture i386:
  ".objc_class_name_NSAutoreleasePool", referenced from:
      pointer-to-literal-objc-class-name in ResourcePath.o
  ".objc_class_name_NSBundle", referenced from:
      pointer-to-literal-objc-class-name in ResourcePath.o
  "_objc_msgSend", referenced from:
      resourcePath() in ResourcePath.o
  "_NSLog", referenced from:
      resourcePath() in ResourcePath.o
  "___CFConstantStringClassReference", referenced from:
      CFString in ResourcePath.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Note that I have tried downloading binaries and from source. The problem seems to be xcode project file. When I download from source and compile from unix Makefile it produces working examples BUT I still cannot get xcode project to compile so the issue is the project setup in xcode.

Anyone else have this problem or do people just use codeblocks on mac instead?
(XCode seems a bit of a dog)



Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: xcode projects will not compile (link)
« Reply #1 on: September 27, 2013, 12:54:45 pm »
Have a look here http://en.sfml-dev.org/forums/index.php?topic=12918.0 Someone else had a similar issue but never came back with more info. You'll find some leads. Also, look for more general solution on the web.

Maybe try recompiling SFML yourself.
SFML / OS X developer

joseph90

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: xcode projects will not compile (link)
« Reply #2 on: September 27, 2013, 01:29:12 pm »
Have recompiled a number of times.  It is a project template problem of some sort.  I am new to xcode and so far the stuff I found on google is no help. I will try again but unless someone here knows how to solve the problem I am considering changing to code blocks. Does anyone use this on mac with SFML? and if so how does it do?

J.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: xcode projects will not compile (link)
« Reply #3 on: September 27, 2013, 02:08:47 pm »
It works perfectly fine here. have you tried at least the few leads presented in the other thread?

And what do you mean by «Have recompiled a number of times» exactly? Did you follow the Cmake tutorial to install SFML?
SFML / OS X developer

joseph90

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: xcode projects will not compile (link)
« Reply #4 on: September 28, 2013, 04:30:20 pm »
Hi,

Got it to compile and run.  What was missing was the link binary setting for SFML.framework

TargetSettings -> Build Phases -> Link Binary with Libraries -> add "SFML.framework" (picked from list of frameworks).

Then it compiled and run perfectly.

I presume that setting went missing (somehow) during my download of SFML but it is fixed now.

Hope this is helpful to other people on Mac.
Cheers,

Joseph.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: xcode projects will not compile (link)
« Reply #5 on: September 29, 2013, 10:34:20 am »
I'm glad it works for you. But I don't understand why.. SFML.framework contains only header files so it should not be require to link against it.  ???

Are you sure you didn't change another setting?
SFML / OS X developer

joseph90

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: xcode projects will not compile (link)
« Reply #6 on: September 29, 2013, 04:20:56 pm »
Yup, that seemed to be it. All builds before that point stopped with same 5 linker errors.
XCode is big and complex.  Therefore it is not always rational (A bit like people).  It was simpler with Make files and text editors  ???

Joseph.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: xcode projects will not compile (link)
« Reply #7 on: September 29, 2013, 05:30:35 pm »
Ok, thanks for your feedback. It will probably help others.  :)
SFML / OS X developer

joseph90

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: xcode projects will not compile (link)
« Reply #8 on: September 30, 2013, 12:47:43 pm »
Just one further note.

Had same problem on office mac.  Same link errors.  The solution that worked for my mac at home did not work.
I then installed the gcc version of SFML and retried:

TargetSettings -> Build Phases -> Link Binary with Libraries -> add "SFML.framework"
TargetSettings -> Build Phases -> Link Binary with Libraries -> add "Foundation.framework"

Then it built fine.


Conclusions
gcc version works better with  10.6.8 OS X
OR
The only other difference is that I added the libraries BEFORE I did my *first* build. (maybe if the first build is wrong it messes up xcode project files and all subsequent builds?)

In any case I am not going to retry the clang version just yet to see if that was the problem.  I want to actually try some coding first.

Joseph.

 

anything