Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable Warnings for includes folders?

I have to use some library, and have no power to change it or care about it, EveryTime i compile a HUGE number of warnings popup. Useless things like

: warning C4350: behavior change: 'std::auto_ptr<_Ty>::auto_ptr(std::auto_ptr_ref<_Ty>) throw()' called instead of 'std::auto_ptr<_Ty>::auto_ptr(std::auto_ptr<_Ty> &) throw()'

I want to complete disable Warnings to this specific library. |But still want to have warnings to my own code. Is it possible in Visual Studio 2010 ?

like image 427
bratao Avatar asked Mar 01 '11 06:03

bratao


People also ask

How do I stop a GCC warning?

To answer your question about disabling specific warnings in GCC, you can enable specific warnings in GCC with -Wxxxx and disable them with -Wno-xxxx. From the GCC Warning Options: You can request many specific warnings with options beginning -W , for example -Wimplicit to request warnings on implicit declarations.

How do I turn off error warnings?

You can make all warnings being treated as such using -Wno-error. You can make specific warnings being treated as such by using -Wno-error=<warning name> where <warning name> is the name of the warning you don't want treated as an error. If you want to entirely disable all warnings, use -w (not recommended).

How do I turn on all warnings in Visual Studio?

If you want to turn it on (or off) in the project setting, you have to go to: Configuration Properties -> C/C++ -> Command Line and then under Additional Options you can enter: /w3#### to set your warning to level 3, and thus enable it; or you can enter /wd#### to disable a warning.


1 Answers

#pragma warning is one option, though it's probably only feasible if you use precompiled headers or have very few source files in your own project.

#pragma warning (push)
#pragma warning (disable : 4350)
#include <third/party/headers/in/question.h>
#pragma warning (pop)
like image 167
ildjarn Avatar answered Sep 25 '22 05:09

ildjarn