How do I link to frameworks from command line compile?

rharder

Do not read this sign.
I have a short program with a few lines all in main(...) that uses NS... classes and AB... classes (address book api). How do I compile it from the command line (instead of project builder)?

I would expect to see something like
Code:
gcc -framework Foundation.framework:AddressBook.framework main.m
or something, but of course that syntax doesn't work. If I just say "gcc main.m" I get this:

Code:
% [b]gcc main.m[/b]
ld: Undefined symbols:
.objc_class_name_ABAddressBook
.objc_class_name_NSAutoreleasePool
.objc_class_name_NSConstantString
.objc_class_name_Utility
_NSLog
__NSConstantStringClassReference
_kABAddressHomeLabel
_kABAddressProperty
_kABAddressWorkLabel
_kABFirstNameProperty
_kABLastNameProperty
_objc_msgSend
-Rob
 
Thanks. That did it, and I could add frameworks like this:
Code:
% [b]gcc main.m -framework Foundation -framework AddressBook[/b]
-Rob
 
Back
Top