Visual Studio 2005 移植 - WINVER,warning C4996, error LINK1104

一、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

二、编译警告:warning C4996 与 Security Enhancements in the CRT

将过去的工程用VS2005打开的时候。你有可能会遇到一大堆的警告:warning C4996。
比如:
warning C4996: 'fopen': This function or variable may 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 may be unsafe. Consider using sprintf_s instead. To disable deprecation,

use _CRT_SECURE_NO_WARNINGS.

原因是Visual C++ 2005使用了更加安全的run-time library routines。
新的Security CRT functions(就是那些带有“_s”后缀的函数):
http://msdn2.microsoft.com/en-us/library/wd3wzwts(VS.80).aspx

那么如何搞定这些警告呢:
方法一:将原来的旧函数替换成新的Security CRT functions。
方法二:用以下方法屏蔽这个警告。
1.在预编译头文件stdafx.h里(注意:一定要在没有include任何头文件之前)定义下面的宏:
  #define _CRT_SECURE_NO_DEPRECATE
2.#param warning(disable:4996)
3.更改预处理定义:
  项目->属性->配置属性->C/C++ -> 预处理器 -> 预处理器定义,增加_CRT_SECURE_NO_DEPRECATE 
方法三:方法二没有使用新的更安全的CRT函数,显然不是一个值得推荐的方法,可是你又不想一个一个地改,那么还有一个更方便的方法:
  在预编译头文件stdafx.h里(同样要在没有include任何头文件之前)定义下面的宏:
  #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
  在链接的时候便会自动将旧函数替换成Security CRT functions。
注意:这个方法虽然使用了新的函数,但是不能消除警告(原因见红字),你还得同时使用方法二。。。

三、link error 1104
原因:当从vc6移植到.net时,会导致这个链接错误!
解决:项目属性->配置属性->链接器->输入->忽略特定库,加入libcd.lib;或直接在命令行中加入: /nodefaultlib:"libcd.lib"
注意:是否是libcd.lib,与C/C++属性中的“代码生成”选项相关

参考:
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

Visual Studio 2005 移植 - WINVER,warning C4996, error LINK1104的更多相关文章

  1. Visual Studio 2005 移植 (札记之一)【zhuan】

    Visual Studio 2005 移植 - WINVER,warning C4996, error LINK1104 一.WINVER  Compile result:  WINVER not d ...

  2. 【DEBUG】 Visual Studio 2005 DEBUG集

    一. fatal error C1083: 无法打开包括文件:"stdint.h": No such file or directory stdint.h是c99标准的头文件,vc ...

  3. Using Nuget in Visual Studio 2005 & 2008

    NuGet is a Visual Studio extension that makes it easy to install and update third-party libraries an ...

  4. Visual Studio 2005 搭建Windows CE 6.0环境之准备

    Microsoft Visual Studio 2005 Visual Studio 2005 Professional 官方90天试用版英文版:http://download.microsoft.c ...

  5. Visual Studio 2005安装qt-win-commercial-src-4.3.1,并设置环境变量

    虽然已经在Visual Studio 2005下安装Qt4已经n次了,还是打算在上写写安装方法. qt-win-commercial-src-4.3.1.zip.qt-vs-integration-1 ...

  6. visual studio 2005提示脚本错误 /VC/VCWizards/2052/Common.js

    今天在做OCX添加接口的时候,莫名其妙的遇到visual studio 2005提示脚本错误,/VC/VCWizards/2052/Common.js. 网上找了很多资料,多数介绍修改注册表“vs20 ...

  7. Visual Studio 2005 自带单元测试

    一 单元测试简介   单元测试是代码正确性验证的最重要的工具,也是系统测试当中最重要的环节.也是唯一需要编写代码才能进行测试的一种测试方法.在标准的开发过程中,单元测试的代码与实际程序的代码具有同等的 ...

  8. visual studio 2005 win7 64位版下载

    http://www.121down.com/soft/softview-19659.html 软件标签: visual studio visual studio 2005是由微软推出的一款基于.ne ...

  9. win7兼容visual studio 2005 的方法

    http://blog.sina.com.cn/s/blog_74d572890100xv7p.html 今天花了4个小时,结合网上的介绍,本人终于找到了一个可以在win7环境下运行visual st ...

随机推荐

  1. Struts2笔记——struts.xml配置详解

    访问HelloWorld应用的路径的设置 * 在struts1中,通过<action path=“/primer/helloWorldAction.action”>节点的path属性指定访 ...

  2. 【原创】如何在Android中为TextView动态设置drawableLeft等

    如何在Android中为TextView动态设置drawableLeft等   两种方式:   方式1:手动设置固有边界 Drawable drawable = getResources().getD ...

  3. Burpsuite如何抓取使用了SSL或TLS传输的Android App流量

    一.问题分析 一般来说安卓的APP端测试分为两个部分,一个是对APK包层面的检测,如apk本身是否加壳.源代码本身是否有恶意内嵌广告等的测试,另一个就是通过在本地架设代理服务器来抓取app的包分析是否 ...

  4. Eclipse中使用正则表达式搜索替换

    Eclipse中使用正则表达式搜索替换 分类:software | 标签: 正则表达  替换  eclipse  2011-11-29 11:28 阅读(1930)评论(0)编辑删除 最近在eclip ...

  5. 机器人学 —— 机器人感知(Gaussian Model)

    机器人感知是UPNN机器人专项中的最后一门课程,其利用视觉方法来对环境进行感知.与之前提到的机器人视觉不同,机器人感知更侧重于对环境物体的识别与检测.与计算机视觉不同,机器人视觉所识别的物体往往不需要 ...

  6. Windows Services windows域账户管理

    windows  域账户管理 一.什么是域账户: 域账户是域是网络对象的分组.例如:用户.组和计算机.域中所有的对象都存储在 Active Directory 下.Active Directory 可 ...

  7. PHP dirname() 返回路径中的目录部分basename() 函数返回路径中的文件名部分。

    dirname (PHP 4, PHP 5) dirname — 返回路径中的目录部分说明string dirname ( string $path ) 给出一个包含有指向一个文件的全路径的字符串,本 ...

  8. django如何检查创建的模型(model)是否有语法错误或者逻辑错误

    首先,用下面的命令验证模型的有效性: python manage.py validate validate 命令检查你的模型的语法和逻辑是否正确. 如果一切正常,你会看到 0 errors found ...

  9. Vim 新用法

    daw , delete a word cw , delete from cursor to the end then insert mode a word 移动: f ; Aa Oo Cc Ii S ...

  10. leetcode:Plus One

    Given a non-negative number represented as an array of digits, plus one to the number. The digits ar ...