Using libsdl-framework
Braden McDaniel
braden at endoframe.com
Mon Dec 1 00:20:05 PST 2008
Anders F Björklund wrote:
> Braden McDaniel wrote:
>
>> Is MacPorts' libsdl-framework usable directly from C and C++, or do I
>> need an Objective-C entry point as described here?
>>
>> <http://www.libsdl.org/faq.php?action=listentries&category=7#55>
>
> For Cocoa backend with SDL 1.2 you need a SDLMain entry point.
> Normally this is handled by `sdl-config`, not so with Xcode.
Ah, you mean if I'm using libsdl (i.e., not the framework variant).
>> When I try to compile this program:
>>
>> #include <SDL/SDL.h>
>> int main(int argc, char * argv[])
>> {
>> SDL_Init(0);
>> }
>>
>> ... like this:
>>
>> gcc -o foo -framework SDL foo.c
>
> You are missing a "-F/opt/local/Library/Frameworks", as well ?
> (so that it can find it in the ${prefix}, like with -I or -L)
libsdl-framework appears to get installed to /Library/Frameworks, so
this is not required.
>> ... I get this linker error:
>>
>> Undefined symbols:
>> "_main", referenced from:
>> start in crt1.10.5.o
>> ld: symbol(s) not found
>> collect2: ld returned 1 exit status
>>
>> -lSDLmain didn't help (AFAICT, the framework provides no
>> libSDLmain.a); is there some other alternative?
>
> libSDLmain.a is only included with the library (non-framework)
> version of SDL, with the framework you need to compile SDLMain.m
Okay; thanks for the confirmation.
--
Braden McDaniel e-mail: <braden at endoframe.com>
<http://endoframe.com> Jabber: <braden at jabber.org>
More information about the macports-users
mailing list