The simplest method you can use:
Options Project | Configuration Properties | C + + | Preprocessor | Preprocessor Definitions
Join _crt_secure_no_deprecate and _scl_secure_no_deprecate
The following transfers are from: http://blog.csdn.net/hylaking/archive/2007/07/20/1700475.aspx
First, WINVER
Compile Result:
WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
Windows Server 2003
winver>=0x0502
Windows XP
winver>=0x0501
Windows 2000
winver>=0x0500
Windows NT 4.0
winver>=0x0400
Windows Me
winver>=0x0500
Windows 98
winver>=0x0410
Windows 95
winver>=0x0400
At the beginning of the stdafx.h is defined:
0X0501 is the XP SP2
#ifndef WINVER
#define WINVER 0x0501
#endif
Second, compile warning: warning C4996 and Security enhancements in the CRT
When you open the past project with VS2005.
You may encounter a whole bunch of warnings: warning C4996.
Example:
Warning C4996: ' fopen ': This function or variable could be unsafe. Consider using fopen_s instead. To disable deprecation, use
_crt_secure_no_warnings. See online Help for details.
Warning C4996: ' sprintf ': This function or variable could be unsafe. Consider using sprintf_s instead. To disable deprecation,
Use _crt_secure_no_warnings.
The reason is that Visual C + + 2005 uses a more secure Run-time library routines.
The new security CRT functions (which are those with the "_s" suffix):
HTTP://MSDN2.MICROSOFT.COM/EN-US/LIBRARY/WD3WZWTS (vs.80). aspx
So how do we fix these warnings:
Method One: Replace the original old function with the new security CRT functions.
Method Two: Use the following method to block this warning.
1. In the precompiled header file StdAfx.h (Note: Be sure to define the following macros before no include, regardless of the header file):
#define _crt_secure_no_deprecate
2. #param Warning (disable:4996)
3. Change the preprocessing definition:
Property---Properties---->c/c++, preprocessor, pre-processor definition, adding _crt_secure_no_deprecate
Method Three: Method two does not use the new more secure CRT function. Obviously not a recommended method, but you don't want to change it one by one, then another more convenient way:
The following macros are defined in the precompiled header file StdAfx.h (same as before no include, no header files):
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
At the time of the link, the old function will be replaced with the security CRT functions on its own initiative.
Note: This method, although using a new function, does not eliminate the warning (the reason for the red word), you have to use the same time two ...
Third, link error 1104
Cause: When migrating from VC6 to. Net. will cause this link error!
FIX: Ignore specific libraries, add libcd.lib, or add them directly to the command line, such as the linker--type, configuration Properties, Project properties:/nodefaultlib: "LIBCD.lib"
Note: Is libcd.lib, related to the code generation option in C + + properties
Four
Chinese VC8 program apes may often see this warning:
Warning C4819: This file includes characters that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss.
This warning has no bad effect. But will affect the mood:) so still have to govern:
Which file appears with this warning error, open it. Replace with VS2005 's search function. Open the agree to form option, select the current form, find the replacement/n for/n, and then the world will be pure.
Cause: The lookup of/n is a cross-platform carriage return, and the replacement/n is the return of the current code page.
References:
Security enhancements in the CRT:
Http://msdn2.microsoft.com/en-us/library/8ef0s5kh (vs.80). aspx
Secure Template Overloads:
http://msdn2.microsoft.com/en-us/library/ms175759 (vs.80). aspx
Delete: Warning C4996: & #39;sprintf& #39;: This function or variable could be unsafe. Consider method