SDL and XCode

beremeth
Unregistered
 
Post: #1
Hi everyone,

I'm trying to use SDL and SDL_net to create a simple client/server tool (just like the sample code I've found).


But, Zerolinks bugs me, when it's activated, XCode compiles finely but the app bugs :
ZeroLink: unknown symbol '_main'


And, when it's not active, I'm unable to build :
Code:
cd /Users/jeanbapt/NetServer
    /usr/bin/gcc-3.3 -o /Users/jeanbapt/NetServer/build/NetServer -L/Users/jeanbapt/NetServer/build -F/Users/jeanbapt/NetServer/build -F/Users/jeanbapt/NetServer -filelist /Users/jeanbapt/NetServer/build/NetServer.build/NetServer.build/Objects-normal/NetServer.LinkFileList -framework SDL_net -framework SDL -arch ppc -prebind -Wl,-no_arch_warnings
ld: /usr/lib/crt1.o illegal reference to symbol: __objcInit defined in indirectly referenced dynamic library /usr/lib/libobjc.A.dylib
    ld: /usr/lib/crt1.o illegal reference to symbol: __objcInit defined in indirectly referenced dynamic library /usr/lib/libobjc.A.dylib

Can someone give me a hint ?

Thanks in advance.

EDIT : I've used a standard C tool for my project template.
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #2
First, it's a documented bug/feature that zerolink doesn't work for SDL apps. So it goes. I don't know what the specifics are but I've had similar zerolink troubles with my apps, even when they're Cocoa based. So it goes.

Second, to fix your linker error, just add Cocoa.framework, or /usr/lib/libobjc.dylib. Somebody's making objective-c calls -- probably the SDL_net code uses foundation for networking. I don't know. But adding Cocoa.framework or libobjc will do it.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #3
SDL doesn't work with zerolink? Since when? I've been doing that for a long time, and have never had problems.

If you started from a standard C tool, you'll also have to link against a few other libraries. The sdl-config tool will list the flags, but is only installed if you compile SDL from source. It lists:
-L/usr/local/lib -lSDLmain -lSDL -framework Cocoa -framework OpenGL

So you need Cocoa, OpenGL, SDL, and SDLMain. If you are using the frameworks versions, you'll need to include SDLMain.h and SDLMain.M buried in the templates folder.
/Library/Application Support/Apple/Developer Tools/Project Templates/Application/SDL Application/SDLMain.*
Quote this message in a reply
beremeth
Unregistered
 
Post: #4
I need to say i've used an empty C project Annoyed. I'll try with a common SDL-Application template.
Hop, I'm going to try with a regular SDL template.

And now, that works, i'm sorry, but i've learned something at least. Thanks for time and for ideas.
Quote this message in a reply
Moderator
Posts: 770
Joined: 2003.04
Post: #5
TomorrowPlusX Wrote:First, it's a documented bug/feature that zerolink doesn't work for SDL apps. So it goes. I don't know what the specifics are but I've had similar zerolink troubles with my apps, even when they're Cocoa based. So it goes.

Zerolink works fine with SDL, check any of the SDL based uDG entries' Xcode projects.
Quote this message in a reply
Post Reply