Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > An Objective C Build Error?

An Objective C Build Error?
Thread Tools
Registered User
Join Date: Jan 2003
Location: New Brunswick, NJ
Status: Offline
Reply With Quote
Jun 6, 2003, 05:46 PM
 
I am new to Objective C (and C for that matter) and went through the apple tutorial for that language only to get the below error when trying to "build" the application.

----------
Building target "Currency Converter" with build style "Development" (optimization:level '0', debug-symbols:on) - (2 errors)

Missing file or directory: Currency
Missing file or directory: Currency_prefix.h
----------

What is it looking for? I dont see anything (an object or name or interface) that I have called "Currency".

These are the Classes that are in the left-hand column of project builder:
ConverterController.h
ConverterController.m
Converter.h
Converter.m
Currency Converter_prefix.h
main.m

It's probably my ignorance of C that is causing me to overlook something quite obvious.

[Also, can anyone recommend a good Objective C book? O'Reilly's?]
     
Senior User
Join Date: Feb 2003
Location: USA
Status: Offline
Reply With Quote
Jun 6, 2003, 06:04 PM
 
Might be the space in the Currency Converter class name...
MacBook 2.0 160/2GB/SuperDrive
Lots of older Macs
     
Mac Enthusiast
Join Date: Jan 2002
Location: Trondhjem, Norway
Status: Offline
Reply With Quote
Jun 6, 2003, 08:01 PM
 
It's not your lacking knowledge of C

Unfortunately, there is a bug in the current Project Builder that gives this error with project names containing spaces. Try CurrencyConverter in one word. (I don't remember if you need to completely restart the project or if you only need to change the name.)

As for learning ObjC, remember that it is a (small) superset of C. So you need to know at least the basics of C first, or else it's not possible to fully understand ObjC.

There are many C intro books, My first contact with C once was through the O'Reilly book Practical C Programming, by Steve Oualline. It had many small examples that could be compiled directly on the command line. Much of the book isn't relevant for OS X programming (and can be skipped without problems), but I learned a good deal in a short while using this book.

Another practical intro book is C, A Software Engineering Approach. (Darnell/Margolis, Springer). I used this to refreshen my C knowledge not so long ago.

In any case, it's the fundamentals of C you need to know, like the language constructs itself, and some of it's strengths and weaknesses that comes from it being a "low-level" high-level language. C has many standard libraries that comes with it, but I don't think it's that important to fully master their use, since you'll be using the Cocoa frameworks anyway.

If/when you feel you know enough C, you can go ahead with ObjC and Cocoa. There are several ObjC/Cocoa books out there, my only personal experience is with Cocoa Programming, (Anguish et al., SAMS). This book takes great care explaining the ideas, philosopy, and conventions behind Cocoa, before the coding begins. I like this style, but if you want to dive in immediately with the programming, some of the newer O'Reilly books might be what you want. (I've heard that some of their older titles aren't that good.)

Another good option is the book by Aaron Hillegass, which generally got very good reviews. I haven't read it, and I don't know which approach it takes.
     
Registered User
Join Date: Jan 2003
Location: New Brunswick, NJ
Status: Offline
Reply With Quote
Jun 7, 2003, 01:42 PM
 
how about this error?

"warning: return type for ‘convertAmount:atRate:’ defaults to id"

the compiler points to the line:

"total = [converter convertAmount:amt atRate:rate];"

which calls:

------------
- (float) convertAmount:(float)amt atRate:(float)rate
{
return (amt * rate);
}
-----------

The method returns a float, which is what ‘total’ is, and 'amt' and 'rate' are both floats too. So what’s the problem? From what I can tell, everything is right.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jun 7, 2003, 04:03 PM
 
Originally posted by sidecar71:
how about this error?

"warning: return type for ‘convertAmount:atRate:’ defaults to id"

the compiler points to the line:

"total = [converter convertAmount:amt atRate:rate];"

which calls:

------------
- (float) convertAmountfloat)amt atRatefloat)rate
{
return (amt * rate);
}
-----------
Does the file where the method is called import the interface file where it's declared?
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Registered User
Join Date: Jan 2003
Location: New Brunswick, NJ
Status: Offline
Reply With Quote
Jun 7, 2003, 04:34 PM
 
Originally posted by Chuckit:
Does the file where the method is called import the interface file where it's declared?
Yes. I even tried to return an int, but it gives the same error. Maybe it's catching this error at a different location, but I dont know what I would to look for.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jun 7, 2003, 05:13 PM
 
That's just odd. Maybe try cleaning the project? That's my first tack when anything weird is happening, and it works a good deal of the time.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Registered User
Join Date: Jan 2003
Location: New Brunswick, NJ
Status: Offline
Reply With Quote
Jun 10, 2003, 07:03 AM
 
Originally posted by Chuckit:
That's just odd. Maybe try cleaning the project? That's my first tack when anything weird is happening, and it works a good deal of the time.
Actually, something in these files were currupted, because when I went back in, project builder provided messages about not being able to read certain files. I could still use the current build, but I decided to scrap the whole thing and start again. It's an easy program, but I think there may have been confusion between "Currency Converter" and "CurrencyConverter", so I trashed ALL the files.

Thanks again for the help...
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:40 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2