Search code examples
c++visual-c++visual-studio-2008c-preprocessorpragma

#pragma warning is not suppressing a warning


One of my .cpp files is generating warning C4275 due to a 3rd-party header I #include... (the warning is triggered due to a DLL-export class inheriting from a non-DLL-export class as far as I can tell).

I added the line:

#pragma warning(disable : 4275)

As the first line of my .cpp file and yet the warning is still being generated. This is on VC++ 2008, and no PCH is in use.

Why is my #pragma not working, and (other than changing the 3rd-party code) how can I address this?


Solution

  • Generate a preprocessed file and you'll probably find that some other header file's re-enabling the warning.