Question

Is there any way to suppress Compiler warnings ??

Thanks

Was it helpful?

Solution

If you don't want to see them in Xcode, you can suppress them by right-clicking on a source window and selecting Message Bubbles | Errors Only. There will still be a little warning symbol next to the line, but the text of the warnings will not appear.

You can prevent the compiler from generating warnings by opening the project info window and going to the build tab. There is an Inhibit All Warnings checkbox under the GCC #.# - Warnings section. That looks like it will do what you want.

If you're building from the command line, you might try these switches:

-GCC_WARN_INHIBIT_ALL_WARNINGS -w

I've never tried those switches. They were listed in the help area in the project info window.

But the best solution, of course, is to figure out why your code has warnings and fix it.

OTHER TIPS

Yes, I'm all for fixing the warnings, but what if you have an application that you want to have work on 10.4 and upwards, and in some places take advantage of methods/messages in the 10.6, but still work on 10.4?

For example, NSDate.addTimeInterval has been deprecated, so for 10.6 it's better to use NSDate.dateByAddingTimeInterval.

From what I can work out, no matter what I do, I'm going to end up with a warning on one or the other. If I add the code:

if ([NSDate instancesRespondToSelector:@selector(dateByAddingTimeInterval)]) {
  timer = [[NSTimer alloc] initWithFireDate:[nowDate dateByAddingTimeInterval:10.0] interval:0.05 target:self selector:@selector(fade:) userInfo:nil repeats:YES];
} else {
  timer = [[NSTimer alloc] initWithFireDate:[nowDate addTimeInterval:10.0] interval:0.05 target:self selector:@selector(fade:) userInfo:nil repeats:YES];
}

The I get a warning on the first half of the if statement if the sdk version is 10.5, and a warning on the second half if the sdk version is 10.6.

If I know the code is OK, is there a pragma or similar construct that will allow me to tell the compiler, that the line in question is OK?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top