C ++ Disabling warnings on a specific inclusion

I am wondering if there is a way to disable all warnings in a specific file (e.g. using the preprocessor directive).

I am using CImg.h and I want to get rid of the warnings associated with this code.

I am compiling both VS (version for Windows) and gcc (one of Linux), so I would like to have a general way ...

Thanks!

+6
c ++ include warnings
source share
2 answers

You can do this using #pragma in the Microsoft compiler:

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

Something like that:

 #pragma warning (push, 0) //....header file #pragma warning (pop) 

It is impossible to help you with the gcc compiler, the information is here: Selectively disable GCC warnings for only part of the translation unit?

EDIT EDIT Try push, 0 .

+6
source share

See #pragma warning .

+1
source share

All Articles