Re: PCH not being used
Re: PCH not being used
- Subject: Re: PCH not being used
- From: Burt Johnson <email@hidden>
- Date: Sun, 22 Jan 2006 19:18:25 -0800
>I thought everything in ObjC inherited from NSObject. If so, I would
>assume that all of ObjC automatically knows about this class. Note that
>my pch file now has only the default code:
>
>>>>>>>>>>>>>>
>#ifdef __OBJC__
> #import <Cocoa/Cocoa.h>
>#endif
><<<<<<<<<<<<<
>
>That should be sucking in NSObject, shouldn't it?
>
>
>Everything in Objective-C does, indeed, inherit from NSObject. Now, I'm
>totally guessing here, but my guess is that you've got a .c, .cp, or, or
>.cpp file in your project that is including this header file. Those files
>won't be compiled by the Objective-C compiler, so because of the #ifdef
>__OBJC__ macro, the #import won't be used and it won't find a definition
>of NSObject. It can be tricky using Cocoa with existing C and C++ classes.
>Using existing C functions from within Cocoa is no problem; C++ functions
>are only a little hassle, but if you are going to be writing C functions
>that need to use or return Objective-C objects, you probably should make
>them .m files instead of .c. Since Objective-C is a superset of C, they'll
>compile fine. C++ is a little more problematic, and if that's your case,
>you should probably do some reading. I haven't had to deal much with C++
>in probably five years, so I'm not the right person to advise you on
>mixing Objective-C and C++, but I know it can be done and that there are
>people on the list who do it regularly.
This is happening in the 'win.h' file that I just created. That is being
imported by a '.m' file, so I believe it should be interpreted as ObjC.
>
>There's a bit of information in the Cocoa documentation about mixing C++
>and Objective-C:
><http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_4_section_10.html>http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_4_section_10.html
>
Gotta go make dinner now before my wife divorces me from hunger, but I'll
read this tonight. Thanks!
--
- Burt Johnson
MindStorm, Inc.
email@hidden
http://www.mindstorm-inc.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden