# Objective-C Questions



## kellywestbrooks (Oct 1, 2001)

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?


----------



## rharder (Oct 1, 2001)

I can't answer your question fully, but you can run pbxbuild from the command line to compile a ProjectBuilder project.
	
	



```
% [b]cd MyProject[/b]
% [b]pbxbuild[/b]
```
Sorry I can't help more.

-Rob


----------



## blb (Oct 1, 2001)

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 &lt;Cocoa/Cocoa.h&gt;

in it).


----------



## kellywestbrooks (Oct 6, 2001)

thanks...i figured it out long ago, but appreciate the replies nonetheless...


----------

