C++ Disabling warnings on a specific include

c++, include, warnings

Solution

You can do it using `#pragma` in Microsoft compiler:

http://msdn.microsoft.com/en-us/library/2c8f766e%28VS.80%29.aspx

Something like this:

#pragma warning (push, 0)

//....header file

#pragma warning (pop)

Can't help you with gcc compiler, some info here: Selectively disable GCC warnings for only part of a translation unit?

EDIT EDIT Try `push, 0`.

Problem

I'm wondering if there's a way to disable all warnings on a specific file (for example, using a preprocessor directive). I'm using CImg.h and I want to get rid of the warnings involving that code. I'm compiling both with VS (the version for Windows) and gcc (the Linux one), so I would like to have a generic way... Thanks!

Original source

Related problems