Search

strsafe.h triggers many warnings with STL header files by pgroke

Closed
as Fixed Help for as Fixed

1
1
Sign in
to vote
Type: Bug
ID: 646532
Opened: 2/23/2011 4:33:32 PM
Access Restriction: Public
1
Workaround(s)
2
User(s) can reproduce this bug
Including <strsafe.h> before STL header files like <string> yields many warnings from inside the STL header files.

There is a simple workaround: include <strsafe.h> after all STL headers, but I still think this should be fixed. Just including a bunch of headers that ship with the compiler should not trigger any warnings.
Details (expand)

Visual Studio/Silverlight/Tooling version

Visual Studio 2010

What category (if any) best represents this feedback?

 

Steps to reproduce

Try to compile the following code in a C++ project with MFC support:

#define _WIN32_WINNT 0x0601

#define _CRT_SECURE_NO_WARNINGS // those have no effect whatsoever
#define _SCL_SECURE_NO_WARNINGS // ""

#include <afx.h>
#include <strsafe.h>
#include <string>

int main()
{
}

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

1>------ Build started: Project: vc10test, Configuration: Debug Win32 ------
1> vc10test.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdio(48): warning C4995: 'gets': name was marked as #pragma deprecated
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdio(52): warning C4995: 'sprintf': name was marked as #pragma deprecated
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdio(55): warning C4995: 'vsprintf': name was marked as #pragma deprecated
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstring(21): warning C4995: 'strcat': name was marked as #pragma deprecated
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstring(22): warning C4995: 'strcpy': name was marked as #pragma deprecated
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cwchar(30): warning C4995: 'swprintf': name was marked as #pragma deprecated
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cwchar(31): warning C4995: 'vswprintf': name was marked as #pragma deprecated
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cwchar(33): warning C4995: 'wcscat': name was marked as #pragma deprecated
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cwchar(35): warning C4995: 'wcscpy': name was marked as #pragma deprecated
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\string(757): warning C4995: 'swprintf': name was marked as #pragma deprecated
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\string(766): warning C4995: 'swprintf': name was marked as #pragma deprecated
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\string(775): warning C4995: 'swprintf': name was marked as #pragma deprecated
1> vc10test.vcxproj -> S:\source\vc10test\Debug\vc10test.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Expected results

1>------ Build started: Project: vc10test, Configuration: Debug Win32 ------
1> vc10test.cpp
1> vc10test.vcxproj -> S:\source\vc10test\Debug\vc10test.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 3/1/2011 at 5:07 PM
Hi,

Thanks for reporting this bug. We've already reported it to Windows, and they've already fixed it in the Windows SDK. This fix will be available in VC11.

If you have any further questions, feel free to E-mail me at stl@microsoft.com .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by Microsoft on 2/23/2011 at 6:04 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 2/23/2011 at 5:14 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by AbdElRaheim on 11/7/2011 at 11:19 PM
#pragma warning( push )
#pragma warning( disable : 4995 )
#include <string>
#pragma warning( pop )