Objective-C Questions

kellywestbrooks

Registered
Hello,

Does anyone know how to compile Objective-C source code directly from the command line without using project builder? I have some code that compiles fine under PB, but every time I use cc, it fails to compile. I am thinking its because I am using cc wrong, and my source is fine.

Perhaps I am not linking to the correct libraries?
 
I can't answer your question fully, but you can run pbxbuild from the command line to compile a ProjectBuilder project.
Code:
% [b]cd MyProject[/b]
% [b]pbxbuild[/b]
Sorry I can't help more.

-Rob
 
First thing is to make sure the file is named correctly, which means it should have a '.m' extension.

Second, you need to tell it to link properly against any frameworks you use. For example,

cc -framework Cocoa -o testit testit.m

will compile testit.m and link in Cocoa stuff (since it has

#import <Cocoa/Cocoa.h>

in it).
 
Back
Top