Question 1 :
Buildingan MFC project for a non-Unicode character set is deprecated
Workaround :
The MFC library (DLL) for Multibyte Character Coding (MBCS) is no longer included with Visual Studio , but is available as a plugin that you can download on any computer with Visual Studio Professional , VisualStudio Premium , or Visual Studio Ultimate and install. (In Visual Studio , MFC must be enabled .) Installation requires approximately 440 MB of disk space, including English (US) and localized versions of the DLLs .
After installing the MBCS DLL , if you uninstall or repair Visual Studio , it will also uninstall or repair. However, if you just disable MFC , the MBCS DLL will still remain on the system. If you just uninstall or repair the MBCS DLL , VisualStudio will not be modified .
The conclusion is to install Multibyte MFC Library for Visual Studio 2013
Details: http://blogs.msdn.com/b/vcblog/archive/2013/07/08/mfc-support-for-mbcs-deprecated-in-visual-studio-2013.aspx
Download address: http://www.microsoft.com/zh-cn/download/details.aspx?id=40770
Question 2 :
warning C4996:'MBCS_Support_Deprecated_In_MFC': MBCS support in MFC is deprecated and may beremoved in a future version of MFC.
Workaround :
This link http://go.microsoft.com/fwlink/p/?LinkId=279048 mentions that this warning can be eliminated by adding the NO_WARN_MBCS_MFC_DEPRECATION preprocessor definition to your project build definition. Add below #pragmaonce in the project stdafx.h file
#define NO_WARN_MBCS_MFC_DEPRECATION
Question 3 :
errorC1189: #error : MFC does not support WINVER less than 0x0501. Please change thedefinition of WINVER in your project properties or precompiled header.
Workaround :
Put the stdafx.h file in
#define WINVER 0x0400
#define WINVER 0x0501
#define _WIN32_WINNT 0x0400
change to
#define _WIN32_WINNT 0x0501
Question 4
error LNK1295 '/OPT:NOREF' is incompatible with '/LTCG:incremental' specification; do not use '/LTCG:incremental' when linking
Solution
链接器->优化
问题5
LNK4075: ignoring '/EDITANDCONTINUE'due to '/SAFESEH' specification
LNK1281 无法生成 SAFESEH影像
LNK2026 模块对于SAFESEH映像是不安全的。
解决方法:
开始在命令行进行设置
/SAFESEH:NO
问题6
vs2015编译工程无法通过,odbccp32.lib(dllload.obj) : errorLNK2019: 无法解析的外部符号 __vsnwprintf_s,
说明vs2015确实这个库,解决办法:
1)在vs2015安装文件夹Lib文件放入odbccp32.lib文件
2)打开编译文件,项目\属性\连接器\输入\附加依赖里面输入
D:\Program Files (x86)\Microsoft VisualStudio 14.0\lib\odbccp32.lib
问题7
error:LNK2005 已经在*.obj中定义
解决方法:
说明你工程中的类的函数与新的vs2015中某个xxx.lib有冲突,修改你工程的类名称为一个特殊的名字。
问题8
比如:
出现“C:\Program Files (x86)\Microsoft Visual Studio14.0\VC\include\stdint.h(17): error C2632: “char”后面的“char”非法”错误。stdint.h文件17行是typedef signedchar int8_t;
解决方法:
先查找工程中引用int8_t的地方,屏蔽掉这段代码,增加 #include<cstdint>
总的解决方法如下:
Features of C standard Library are also provided in the C++ Standard libraryand as a general naming convention they are pre-pended by an c to thecorresponding names in C standard library.
In C++, You should be using:
#include <cstdint>
and fully qualify the symbol names you use with std::
while in C, You should use:
#include <stdint.h>
https://stackoverflow.com/questions/13642827/cstdint-vs-stdint-h
问题9
在工程子目录中包括#include "stdafx.h" ,并且包含了一些VC的类函数非WIN32标准函数,容易出现预编译不对问题。
解决方法:
1)、包含目录,全路径
#include"../stdafx.h"
怎么让VS2015编写的程序在XP中顺利运行
参考下面这篇文章
https://blog.csdn.net/liuyez123/article/details/51497104
VS2015开发XP程序的设置
1). 项目菜单->项目属性->配置属性->常规->平台工具集,选择“VS2013WindowsXP(v120_xp)”;
2). 项目菜单->项目属性->配置属性->常规->MFC的使用,选择使用标准Windows库;如果选用静态库编译的话选用静态库中选用MFC。
3). 项目菜单->项目属性->配置属性->常规->字符集中使用多字节字符集或使用Unicode字符集
4). 项目菜单->项目属性->链接器->系统->子系统->控制台或窗口windows(根据你的项目类型选择),第二项版本号设成5.01。
实际测试的时候这两项不设置也可以,连接器和自动匹配。
5). C/C++->链接器->命令行,输入相应的命令行,这一步非常关键,否则会出现“不是有效的win32应用程序”提示;
根据程序设计的运行环境是图形窗口还是命令行窗口设置不同的命令行选项,如果运行环境是命令行窗口则使用如下命令:
/SUBSYSTEM:CONSOLE,”5.01” (for Win32用在32位平台)
/SUBSYSTEM:CONSOLE,”5.02” (for x64用在64平台)
如果运行环境是图形窗口则使用如下命令:
/SUBSYSTEM:WINDOWS,”5.01” (for Win32用在32位平台)
/SUBSYSTEM:WINDOWS,”5.02” (for x64用在64平台)
现在就可以编译运行程序了,试试看吧。