Using libsdl-framework
Anders F Björklund
afb at macports.org
Sun Nov 30 23:46:36 PST 2008
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.
> 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)
> ... 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
--anders
More information about the macports-users
mailing list