下面是个好的解决方法
也可以用 #pragma warning(disable:4995)搞定
1>e:/program files/microsoft visual studio 9.0/vc/include/cstdio(49) : warning C4995: 'gets': name was marked as #pragma deprecated
1>e:/program files/microsoft visual studio 9.0/vc/include/cstdio(53) : warning C4995: 'sprintf': name was marked as #pragma deprecated
1>e:/program files/microsoft visual studio 9.0/vc/include/cstdio(56) : warning C4995: 'vsprintf': name was marked as #pragma deprecated
1>e:/program files/microsoft visual studio 9.0/vc/include/cstring(22) : warning C4995: 'strcat': name was marked as #pragma deprecated
1>e:/program files/microsoft visual studio 9.0/vc/include/cstring(23) : warning C4995: 'strcpy': name was marked as #pragma deprecated
1>e:/program files/microsoft visual studio 9.0/vc/include/cwchar(36) : warning C4995: 'swprintf': name was marked as #pragma deprecated
1>e:/program files/microsoft visual studio 9.0/vc/include/cwchar(37) : warning C4995: 'vswprintf': name was marked as #pragma deprecated
1>e:/program files/microsoft visual studio 9.0/vc/include/cwchar(39) : warning C4995: 'wcscat': name was marked as #pragma deprecated
1>e:/program files/microsoft visual studio 9.0/vc/include/cwchar(41) : warning C4995: 'wcscpy': name was marked as #pragma deprecated
原因:
在程序里使用了StringCchCopy函数,引入了头文件C:/Program Files/Microsoft SDKs/Windows/v6.0A/include/Strsafe.h,在该文件的9487行:
#ifndef STRSAFE_NO_DEPRECATE
// Deprecate all of the unsafe functions to generate compiletime errors. If you do not want
// this then you can #define STRSAFE_NO_DEPRECATE before including this file
#ifdef DEPRECATE_SUPPORTED
// First all the names that are a/w variants (or shouldn't be #defined by now anyway)
#pragma deprecated(lstrcpyA)
#pragma deprecated(lstrcpyW)
#pragma deprecated(lstrcatA)
#pragma deprecated(lstrcatW)
#pragma deprecated(wsprintfA)
#pragma deprecated(wsprintfW)
…
呵呵,因为单词Deprecate 的意思是藐视,
从而也看到了解决方案,如果不想看到这些警告,就在引入strsafe.h的前面定义#define STRSAFE_NO_DEPRECATE (不要藐视这些不安全的函数^_^)