Re: Obj-C header-file becoming C header-file, & NSImage problem
Re: Obj-C header-file becoming C header-file, & NSImage problem
- Subject: Re: Obj-C header-file becoming C header-file, & NSImage problem
- From: Wade Tregaskis <email@hidden>
- Date: Mon, 26 Jul 2004 10:33:30 +1000
Sorry if this is a repost, but Apple unsubscribed me from all their
mailing lists again, and I never got a message one way or another from
the moderators as to whether the "off-list" message made it on-list.
This structure is passed all over the place, and eventually comes back
with
intersectedObject pointing at the lucky object. This had been working
perfectly, until I added PMTypes.c (for doing the vector manipulation
stuff), and included a C function prototype in PMTypes.h. Now, the
compiler
always generates errors for the line 'id intersectedObject' in
PMTypes.h. If
I change this to 'void *intersectedObject', it compiles and I can send
messages just fine, but I need to cast the void* to id in message
sends to
avoid warnings. Its like the H file has been demoted from ObjC to C
and the
compiler doesnt understand 'id' anymore. Is there some other way around
this?
The compiler is rather tolerant of orphaned header files,
auto-detecting their type fairly reliably, in my experience. Of
course, when you add a corresponding source file it tries to be smart
and take the source's type as the header's type. Mostly this works
well, but of course in your case this is not so. Open the Inspector,
select your header file, and change the file type from "sourcecode.c.h"
to "source.c.objc". There appears to be no specific header type for
ObjC, which I suspect is simply indicative of the fact that source &
header files in ObjC are considered syntactically and semantically
equivalent.
The other recommendations, on changing your source file's extension and
the like, are equally valid, although the method I've proposed is more
flexible as it extends to other situations as well.
Wade Tregaskis (aim: wadetregaskis)
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.