Search code examples
c++suppress-warnings

Suppress deprecation warning for one line of code? (C++)


How do you suppress the deprecation warning for one line of code?


Solution

  • This code should accomplish what you're trying to do.

    #pragma warning(push)
    #pragma warning(disable: WARNING_CODE) //4996 for _CRT_SECURE_NO_WARNINGS
    // Insert deprecated code here
    #pragma warning(pop)