How to disable warning
Maybe I'm not the first to ask this question.
How can I disable some specific warning like C4100 ?
(warning does not come from my code but from external library)
QMAKE_CXXFLAGS += -wd4100
QMAKE_CXXFLAGS += -Wno-unused-parameter
QMAKE_CXXFLAGS += /wd4100 /wd4101 /wd4102 /wd4189 /wd4996
QMAKE_CXXFLAGS_WARN_ON = -Wall -Wno-unused-parameter nok
QMAKE_CXXFLAGS += -wd4100 -wd4101 -wd4102 -wd4189 -wd4996
QMAKE_CXXFLAGS_WARN_ON -= wd4100
no one is working.
So I compile with msvc14 for now and I will compile my application with clang for a MAC compilation.
I would like to know how to disable these warning for the both compilers.
(Sorry for my bad english)
Personally I really don't like disabling warnings globally because of 3rd party libraries. My stance is that just because some library is not clean doesn't mean I don't want to keep my own code clean.
What I usually do is wrap the includes from the offending library and disable the warning locally only for it.
For example if I have:
#include "dirtydirty.h" //causes some warning
I create a wrapper header like this:
//clean.h #ifdef _MSC_VER //just for MSVC #pragma warning (push) #pragma warning (disable: 4100 4101 4102) #include "dirtydirty.h" #pragma warning (pop) #elif ...// other compilers #endif
and then include that: