PDA

View Full Version : Objective-C/Cocoa Basics




mck9235
Feb 18, 2008, 07:12 PM
I'm trying to learn some of the basics of Cocoa by following along an Apple Developer guide (http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_2.html). Currently, I have this Cocoa sample code that I want to run in XCode, but it simply won't let me build/run a single file.

I don't want to create a whole project, just run a simple file! Any help is appreciated. :) Let me know if I wasn't descriptive enough on anything.

Thanks



toddburch
Feb 18, 2008, 07:14 PM
The way Xcode works is that you'll have to create a New Project.

sord
Feb 18, 2008, 07:51 PM
Or you can compile with gcc.
gcc -framework Cocoa -o <output file> <input file>
(Or something like that -- I'm not by my OS X machine to test)
Not sure if this will work for applications with nibs, but for straight Obj-C + Cocoa it should. The O'Reilly "Objective-C Pocket Reference" explains exactly how to do it.

EDIT: I got off of my *** and grabbed the book - I was wrong, I can't remember which book it was that explains it.

azizane
Feb 21, 2008, 08:13 AM
I believe it's: gcc Filename(s) -o OutputFilename

I think you mean Stephen Kochan's "Programming in objective-c". Also not sure on applications with nibs.

Or you can compile with gcc.
gcc -framework Cocoa -o <output file> <input file>
(Or something like that -- I'm not by my OS X machine to test)
Not sure if this will work for applications with nibs, but for straight Obj-C + Cocoa it should. The O'Reilly "Objective-C Pocket Reference" explains exactly how to do it.

EDIT: I got off of my *** and grabbed the book - I was wrong, I can't remember which book it was that explains it.

azizane
Feb 21, 2008, 08:13 AM
I believe it's: gcc Filename(s) -o OutputFilename

I think you mean Stephen Kochan's "Programming in objective-c". Also not sure on applications with nibs.

Update: sorry got posted twice by mistake :s

Or you can compile with gcc.
gcc -framework Cocoa -o <output file> <input file>
(Or something like that -- I'm not by my OS X machine to test)
Not sure if this will work for applications with nibs, but for straight Obj-C + Cocoa it should. The O'Reilly "Objective-C Pocket Reference" explains exactly how to do it.

EDIT: I got off of my *** and grabbed the book - I was wrong, I can't remember which book it was that explains it.

Cromulent
Feb 21, 2008, 08:22 AM
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/ObjC.pdf

This book will probably help a lot when it comes to programming.