Using SDL with OSX C++

Hi everyone,

I’m trying to put SDL into an OSX C++ (carbon) project.
The problem is that SDL seems to be written in objective-C,
and when I compile it gives me:

ld: /usr/lib/crt1.o illegal reference to symbol:
__objcInit defined in indirectly referenced dynamic library
/usr/lib/libobjc.A.dylib

Does anyone know how to glue my C++ project to SDL?

Thank you
Chris

SDL is written in C not objective C.On 1/13/06, Chris Ball wrote:

Hi everyone,

I’m trying to put SDL into an OSX C++ (carbon) project.
The problem is that SDL seems to be written in objective-C,
and when I compile it gives me:

ld: /usr/lib/crt1.o illegal reference to symbol:
__objcInit defined in indirectly referenced dynamic library
/usr/lib/libobjc.A.dylib

Does anyone know how to glue my C++ project to SDL?

Thank you
Chris


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Olivier Delannoy wrote:

SDL is written in C not objective C.

Some of the Mac specific parts are in Objective C (Cocoa).

Chris Ball wrote:

I’m trying to put SDL into an OSX C++ (carbon) project.
The problem is that SDL seems to be written in objective-C,
and when I compile it gives me:

ld: /usr/lib/crt1.o illegal reference to symbol:
__objcInit defined in indirectly referenced dynamic library
/usr/lib/libobjc.A.dylib

Does anyone know how to glue my C++ project to SDL?

I’ve never used SDL with C++, and I actually know very little about C++,
but anyway: You need to link your application with the Cocoa
framework, are you doing that? “-framework Cocoa” on the command line,
or add the Cocoa framework to the project in Xcode.

-Christian

You probably need to add ‘-lobjc’ to your CFLAGS, to link in the ObjC
lib.

Richard SchreyerOn Jan 13, 2006, at 8:14 AM, Christian Walther wrote:

Olivier Delannoy wrote:

SDL is written in C not objective C.

Some of the Mac specific parts are in Objective C (Cocoa).

Chris Ball wrote:

I’m trying to put SDL into an OSX C++ (carbon) project.
The problem is that SDL seems to be written in objective-C,
and when I compile it gives me:
ld: /usr/lib/crt1.o illegal reference to symbol:
__objcInit defined in indirectly referenced dynamic library /usr/
lib/libobjc.A.dylib
Does anyone know how to glue my C++ project to SDL?

I’ve never used SDL with C++, and I actually know very little about
C++, but anyway: You need to link your application with the Cocoa
framework, are you doing that? “-framework Cocoa” on the command
line, or add the Cocoa framework to the project in Xcode.

-Christian


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Thanks you guys

You probably need to add ‘-lobjc’ to your CFLAGS, to link in the ObjC
lib.

Use “-framework Cocoa” … don’t link with the Objective C runtime directly.

–ryan.