[MAC OS X, XCODE 2]Linker Problem

Hi,
Im trying to develop with SDL and SDL_image in XCODE on Mac OS X Tiger.
Everytime i call a IMG_Load() function, i get a linker error, that the
function SDL_ERROR cannot be found. But if i compile it with a makefile it
works witout problems. The SDL_Image Framework is added to the Xcode Project
correctly. Does anyone know whats the fault about this ?

The error output of Xcode is like this :

“-F/Library/Frameworks” -filelist “/Users/thomasschober/xcode
Projekte/SDLtest/build/SDLtest.build/Development/SDLtest.build/Objects-norma
l/LinkFileList” “-arch” “ppc” “-prebind” “-Wl,-no_arch_warnings”
"-framework" “SDL” “-framework” “Cocoa” “-framework” “SDL_image”
/usr/bin/ld: warning prebinding disabled because dependent library:
@executable_path/…/Frameworks/SDL_image.framework/Versions/A/SDL_image is
not prebound
/usr/bin/ld: Undefined symbols:
_SDL_Error referenced from
@executable_path/…/Frameworks/SDL_image.framework/Versions/A/SDL_image
expected to be defined in SDL
collect2: ld returned 1 exit status
/usr/bin/ld: warning prebinding disabled because dependent library:
@executable_path/…/Frameworks/SDL_image.framework/Versions/A/SDL_image is
not prebound
/usr/bin/ld: Undefined symbols:
_SDL_Error referenced from
@executable_path/…/Frameworks/SDL_image.framework/Versions/A/SDL_image
expected to be defined in SDL
collect2: ld returned 1 exit status
Build failed (2 errors, 1 warning)

It is caused by this function call :

pic =(SDL_Surface *)IMG_Load(“24PArialN.png”);

If i just use SDL it works, but who wants to use Bitmaps in BMP format ?

Thanks for any Help

Tom

Hi,
Im trying to develop with SDL and SDL_image in XCODE on Mac OS X Tiger.
Everytime i call a IMG_Load() function, i get a linker error, that the
function SDL_ERROR cannot be found. But if i compile it with a makefile it
works witout problems. The SDL_Image Framework is added to the Xcode Project
correctly. Does anyone know whats the fault about this ?

The error output of Xcode is like this :

“-F/Library/Frameworks” -filelist “/Users/thomasschober/xcode
Projekte/SDLtest/build/SDLtest.build/Development/SDLtest.build/Objects-norma
l/LinkFileList” “-arch” “ppc” “-prebind” “-Wl,-no_arch_warnings”
"-framework" “SDL” “-framework” “Cocoa” “-framework” “SDL_image”
/usr/bin/ld: warning prebinding disabled because dependent library:
@executable_path/…/Frameworks/SDL_image.framework/Versions/A/SDL_image is
not prebound
/usr/bin/ld: Undefined symbols:
_SDL_Error referenced from
@executable_path/…/Frameworks/SDL_image.framework/Versions/A/SDL_image
expected to be defined in SDL
collect2: ld returned 1 exit status
/usr/bin/ld: warning prebinding disabled because dependent library:
@executable_path/…/Frameworks/SDL_image.framework/Versions/A/SDL_image is
not prebound
/usr/bin/ld: Undefined symbols:
_SDL_Error referenced from
@executable_path/…/Frameworks/SDL_image.framework/Versions/A/SDL_image
expected to be defined in SDL
collect2: ld returned 1 exit status
Build failed (2 errors, 1 warning)

It is caused by this function call :

pic =(SDL_Surface *)IMG_Load(“24PArialN.png”);

If i just use SDL it works, but who wants to use Bitmaps in BMP format ?

Thanks for any Help

Tom

It’s hard to say what’s wrong from what’s listed here. I am not able
to reproduce your problem. Your build lines look generally correct,
particularly -framework SDL -framework Cocoa -framework SDL_image. I
don’t know why there are quotes around yours though. My Xcode lines do
not have the quotes.

Here are some things to check:

  • Are both your SDL.framework and SDL_image.frameworks up-to-date? Are
    these the official ones or ones you built yourself?

  • Do you have multiple framework versions installed (perhaps one in
    ~/Library/Frameworks and one in /Library/Frameworks). It could be that
    you’re linking against the wrong ones.

  • Are your frameworks Universal Binaries? It could be that only one
    architecture is present and when you try linking against the missing
    architecture, the symbols turn up missing. You can run lipo to find
    this info, e.g. ‘lipo -info SDL.framework/SDL’ to find the built
    archtectures.

You can also run nm to find if the symbols are present, e.g. ‘nm
SDL.framework/SDL | grep SDL_Error’

-Eric

Hi,

  1. My Frameworks have been downloaded a few days ago, becaus i thought the
    errors could have been fixed.

  2. No, just one Framework

  3. My Frameworks are no universal binarys, just PPC.

  4. nm SDL.framework/SDL | grep SDL_Error gives me this output :
    30025cbc t _SDL_Error

I try to solve this problem a long time now, most of the time i used
makefiles again, because they work better. I don’t have any Idea whats wrong
with xcode.On 18.07.2006 7:41 Uhr, in article 3c7e3c8a0607172241u21c7db27l55606d4ec717dc8e at mail.gmail.com, “E. Wing” wrote:

It’s hard to say what’s wrong from what’s listed here. I am not able
to reproduce your problem. Your build lines look generally correct,
particularly -framework SDL -framework Cocoa -framework SDL_image. I
don’t know why there are quotes around yours though. My Xcode lines do
not have the quotes.

Here are some things to check:

  • Are both your SDL.framework and SDL_image.frameworks up-to-date? Are
    these the official ones or ones you built yourself?

  • Do you have multiple framework versions installed (perhaps one in
    ~/Library/Frameworks and one in /Library/Frameworks). It could be that
    you’re linking against the wrong ones.

  • Are your frameworks Universal Binaries? It could be that only one
    architecture is present and when you try linking against the missing
    architecture, the symbols turn up missing. You can run lipo to find
    this info, e.g. ‘lipo -info SDL.framework/SDL’ to find the built
    archtectures.

You can also run nm to find if the symbols are present, e.g. ‘nm
SDL.framework/SDL | grep SDL_Error’

-Eric

  1. My Frameworks have been downloaded a few days ago, becaus i thought the
    errors could have been fixed.
  1. My Frameworks are no universal binarys, just PPC.

All the frameworks from the official site are built as Universal
Binaries so I don’t know where you downloaded yours from.

  1. nm SDL.framework/SDL | grep SDL_Error gives me this output :
    30025cbc t _SDL_Error

I try to solve this problem a long time now, most of the time i used
makefiles again, because they work better. I don’t have any Idea whats wrong
with xcode.

This is very telling. The lowercase ‘t’ means that the symbol is not
globally exported so it won’t be visible from a dynamic library. It
should be an uppercase ‘T’. I’m surprised a Makefile works because
this should be a low-level problem that transcends the build system
(Xcode/Make). I consider your framework suspect and don’t think you
should be using it at all.

I just downloaded the SDL.framework from the website. Running nm (on
my PPC machine) yields:
3002a89c T _SDL_Error

Note the uppercase ‘T’. You should probably download the official
1.2.11 framework and use that one instead.

http://www.libsdl.org/download-1.2.php
http://www.libsdl.org/release/SDL-1.2.11.dmg

-Eric