Hi,
Can someone tell me how to suppress all the warnings g++ produces? Not specific warnings : I know how to do that. I want to not see any warnings at all when I build.

Thanks.

Why on earth would you not want to see warnings? You know that 99% of the warnings are actually code-errors that the compiler can compile right?

commented: Well said +36

Hi,
Can someone tell me how to suppress all the warnings g++ produces? Not specific warnings : I know how to do that. I want to not see any warnings at all when I build.

Thanks.

I have to agree with niek_e, since there's really no reason to not want to see the warnings.
Or are you really begging for bugs in your program?
A warning should be taken seriously, because it informs you about potential bugs in your program.
And we don't want that right?
If you find me a good reason, please tell me.
But I'm sure you just can't find one.

IMO you should always compile with all warnings on. (-Wall).

commented: nods +21

I agree that it's generally a very bad idea - but if you DO have a good reason, compile with -Wno

g++ --ostrich-head-in-sand prog.cpp

Please tell us the name of the software you're working on, so we know to avoid it in future. I don't want to be anywhere near this train-wreck of a methodology.

I want to not see any warnings at all when I build.

I haven't seen many warnings that were so asinine they could be completely ignored. Disabling warnings just so you can get a clean compile is not a recommended practice because fixing them almost always makes your code better.

Separating warnings and errors makes sense, and that's the only time I can think of where you might want to use -Wno. But a better way to split up the errors and warnings is redirecting the output of the compiler to a file and then grepping the file on warnings and then errors. That way you don't lose any output and still have a way of focusing on one or the other.

How aggressive...
Anyway, thanks daviddoria. I'll compile with -Wno.

I'm gonna bookmark this thread so I can refer to it, when your next question would have been solved by reading the error messages.

commented: Good point :) +15
commented: Haha +22

How aggressive...

It's a sign of how much everyone cares. A good friend will try to stop you from doing something dumb. ;) Out of curiosity, why do you want to disable all warnings?

It's a sign of how much everyone cares. A good friend will try to stop you from doing something dumb. ;) Out of curiosity, why do you want to disable all warnings?

Because I don't really want to wade through 100s of warnings (I did not write the program, I am just taking over.) looking for a single error and I wan't able to grep stderr. And I am frustrated when it does not build because I am wasting more time trying to get it built when I have deadlines to meet.
Then again, you people are right, In a perfect scenario, I'd take some time and would take care of every warning. But as of when I asked the question, I was in need of a quick solution : -Wno.
Luckily, Not everyone were so concerned with the purity of it and mentioned the solution for which I am grateful.

I did not write the program, I am just taking over.

All the more reason to clean up the warnings too. They will just keep getting in your way, and if you ignore them, one day you will get bitten by whatever they were trying to warn you about.

In a perfect scenario, I'd take some time and would take care of every warning.

In a perfect scenario there would be no errors or warnings. In reality, shipping your code without a clean compile is no different from shipping your code without testing it. I sympathize with you about being under the gun, but producing shit to save time doesn't make you look better than slipping a deadline and producing something of higher quality.

But as of when I asked the question, I was in need of a quick solution : -Wno.

Code quality is the worst place to cut corners. I've pushed back deadlines to get a clean compile before, because I've also been burned by shelving 'minor warnings' to meet a deadline. I kind of hope that your quick solution blows up in your face, because you seem hell bent on learning the hard way instead of listening to others who already learned the hard way.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.