Compiler Warning (level 1) C4996
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Warning (level 1) C4996

'function': was declared deprecated

The compiler encountered a function that was marked with deprecated. The function may no longer be supported in a future release. You can turn this warning off with the warning pragma (example below).

C4996 is generated for the line on which the function is declared and for the line on which the function is used.

You will see C4996 if you are using members of the <hash_map> and <hash_set> header files in the std namespace. See The stdext Namespace for more information.

The following sample generates C4996:

// C4996.cpp
// compile with: /W1
// C4996 expected
#include <stdio.h>
// #pragma warning(disable : 4996)
void func1(void){printf("\nIn func1");}
__declspec(deprecated) void func1(int){printf("\nIn func2");}

int main() {
© 2015 Microsoft