Re: warning in main.m
Re: warning in main.m
- Subject: Re: warning in main.m
- From: Marshall Clow <email@hidden>
- Date: Tue, 30 Dec 2003 18:01:19 -0800
At 5:39 PM -0800 12/30/03, Kaelin Colclasure wrote:
On Dec 30, 2003, at 5:24 PM, matt neuburg wrote:
Since upgrading to Xcode 1.1, every new project that I create generates a
warning in main.m when I try to compile it:
// main.m
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, argv); // warning here!
}
The warning reads: "passing arg 2 of `NSApplicationMain' from incompatible
pointer type".
NSApplicationMain is declared to take 'const char * argv[]' as its
second argument, and it's being passed a non-const one. It's
happening "all of a sudden" because you are using a newer, stricter
version of gcc by default with Xcode.
The warning is easy to eliminate: Just declare the second argument
to main as 'const char * argv[]' rather than 'char * argv[]'.
OK - now _I'm_ seriously confused.
You've got a "char *[]", and NSAppplicationMain is declared to take a
"const char * []"?
And the compiler is complaining about the difference?
If the situation were reversed, and you were trying to pass off a
const as a non-const,
that I could understand - but converting from a non-const to a const is easy.
--
-- Marshall
Marshall Clow Idio Software <mailto:email@hidden>
Hey! Who messed with my anti-paranoia shot?
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.