in C/C++

Visual Studio Community version 2019打开旧VS2008项目的两个问题

最近用Visual Studio Community version 2019打开Visual Studio 2008旧项目的碰到两个问题,并解决。

问题1:提示缺少MFC Library

Visual Studio Community version 2019默认没有安装MFC,那么安装MFC Library,下载vs_community__1819445496.1557801037.exe,在Visual Studio Installer界面中点击Modify按钮,再选择安装安装以下包:

==C++ MFC for latest v142 build tools (x86 & x64)==

安装后问题解决!
安装界面如下:
Install MFC

问题2:编译出现error C2338

问题1解决后出现编译问题,
Severity Code Description Project File Line Suppression State
==Error C2338== va_start argument must not have reference type and must not be parenthesized C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include\vadefs.h 151

出错代码在以下位置,也不是我写的代码:

template <typename _Ty>
struct __vcrt_assert_va_start_is_not_reference
{
   static_assert(!__vcrt_va_list_is_reference<_Ty>::__the_value,
   "va_start argument must not have reference type and must not be parenthesized");
};

参考链接Compilation failes on VS2015, 使用以下代码:

#define _CRT_NO_VA_START_VALIDATION

应该是强制关闭检查,可以通过以下做法,在项目的Preprocessor界面,加入_CRT_NO_VA_START_VALIDATION设置,如下,问题解决,旧项目成功编译执行。

CRT_NO_VA_START_VALIDATION

Reference

关于Visual Studio 2013 编译 multi-byte character set MFC程序出现 MSB8031 错误的解决办法
MFC libraries are required for this project
Compilation failes on VS2015 error C2338

Write a Comment

Comment

9 − seven =