Re: #Import problems
Re: #Import problems
- Subject: Re: #Import problems
- From: "Alastair J.Houghton" <email@hidden>
- Date: Mon, 11 Aug 2003 10:40:51 +0100
On Monday, August 11, 2003, at 12:11 am, Rob Kuilman wrote:
note: the header file i want to include is just plain C, some
const char myVar = 0x10
et al.
*That* doesn't do what you want, at least not in C. When you write
"const char myVar = 0x10", in C, it represents a declaration of a
global *variable* called "myVar" whose type is const char. This is
*not* the same as in C++, where it means declare a *constant* called
"myVar" of type char.
(The reason for the error is that in C, #including or #importing that
file will declare the same global variable in every file you have
#included or #imported it into, which will make the linker complain.)
If you want a similar effect in C/ObjC, you either need to use #define
or enum.
Kind regards,
Alastair.
_______________________________________________
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.