 |
 |
Newby trying to learn Obj-C in XCode...
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2005
Location: Sydney, Australia
Status:
Offline
|
|
Hello... OK so last time I programmed for real was in C on Unix terminals in 1992... Now I'm trying to get into iPhone dev, and that involves...
- XCode environment
- Objective C
Both of which are hurting my brain.
I've decided to learn Objective-C and OO programming in general first, then move onto the frameworks and whatnot of the iPhone.
So I headed to the Objective-C Beginner's Guide at http://www.otierney.net/objective-c.html which is a nice intro, but I can't even get the first Classes example working (the Fractions class) :-(
I have a main.m, Fraction.h, and Fraction.m and I've scoured for syntax errors but in XCode it won't run.... instead i get these errors in the build results:
".objc_class_name_NSObject", referenced from:
.objc_class_name_Fraction in Fraction.o
"_objc_msgSend", referenced from:
_main in main.o
_main in main.o
_main in main.o
_main in main.o
_main in main.o
_main in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I'm really really really new at this and obviously struggling with the very basics so have no idea where I'm going wrong.
I don't even know if I created the correct type of project in XCode, or the right type of file.
Can anyone please help point me in the right direction?
|
|
I want something good to die for, to make it beautiful to live.
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
It sounds like you're not including Cocoa in the project. Did you make a Cocoa Application project (or a Cocoa Document-Based Application, or something else with "Cocoa" in the name)?
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Dec 2000
Status:
Offline
|
|
Sounds like you didn't link against the Foundation framework. Go to Project -> Add To Project... and then add /System/Library/Frameworks/Foundation.framework to the project. Then, your app should compile.
In the future, if you want to use Objective-C, you should start with Xcode's "Foundation Tool" template if you're making a command-line tool, or "Cocoa Application" or "Cocoa Document-based Application" if you're making a full-blown GUI app.
edit: beaten by the other Charles. However, since the only thing missing is NSObject, I'd guess he's trying to make a Foundation tool, and thus including just Foundation should work (but adding the entire Cocoa framework would work too).
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2005
Location: Sydney, Australia
Status:
Offline
|
|
Chuckit and CharlesS... You were both right...
I had created a new project based on the C++ Tool Template (d'Oh!), as the Objective-C Beginner's Guide didn't specify what to do here (it's IDE-neutral), so I took a stab at what I thought may be right LOL!
Thanks very much guys - adding the Foundation.framework fixed the problem.
I knew it would be simple for you fellas ;-)
|
|
I want something good to die for, to make it beautiful to live.
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Dec 2000
Status:
Offline
|
|
BTW, if you want something that's more specifically tailored to Mac OS X, this book is supposed to be really good for learning Cocoa programming. I haven't read it myself, but I've often seen it heartily recommended by those who have.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2005
Location: Sydney, Australia
Status:
Offline
|
|
Thanks for the advice... I already own that book and it's too advanced for my level ;-)
I'll get there eventually...
|
|
I want something good to die for, to make it beautiful to live.
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jul 2002
Status:
Offline
|
|
A friend of mine from Stanford pointed me to a series of great podcasts on iTunes-U provided for free by Stanford university. Search iTunes for "stanford cs-193p." It's an introductory course to development on the iPhone -- ObjC and Interface Builder. It assumes you have a basic understanding of OOP, like one semester of Java programming or something.
It's been really helpful to me, as I just started digging into ObjC last week.
-Rob
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|