Visual Studio Community 2015 MFC 空项目无法编译

Visual Studio Community 2015 MFC empty project doesn't compile

本文关键字:项目 编译 MFC Studio Community 2015 Visual      更新时间:2023-10-16

我刚刚安装了Visual Studio Community 2015(版本14.0.24720.00),并尝试创建一个基于MFC对话框的项目。在向导中,我只选择了"基于对话框",将所有其他设置保留为默认设置。

该项目根本没有编译,这并不是一个有希望的起点。。。

我是不是忽略了什么?MFC模板是否损坏?

下面是我得到的编译时错误(为了易读,我去掉了长路径)。

谢谢你抽出时间。

program files (x86)microsoft visual studio 14.01>------ Build started: Project: MFCApplication, Configuration: Debug Win32 ------
1>  stdafx.cpp
1>c:[...omissis...]atlcore.h(639): error C2065: 'LOAD_LIBRARY_SEARCH_SYSTEM32': undeclared identifier
1>c:[...omissis...]uianimation.h(2621): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:[...omissis...]afxanimationhelper.h(411): error C2065: 'UI_E_VALUE_NOT_SET': undeclared identifier
1>c:[...omissis...]afxanimationhelper.h(441): error C2065: 'UI_E_VALUE_NOT_SET': undeclared identifier
1>c:[...omissis...]afxwin.h(2103): error C3646: 'm_pConfigs': unknown override specifier
1>c:[...omissis...]afxwin.h(2103): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:[...omissis...]afxwin.h(2024): error C2065: 'GC_PAN_WITH_GUTTER': undeclared identifier
1>c:[...omissis...]afxwin.h(2024): error C2065: 'GC_PAN_WITH_INERTIA': undeclared identifier
1>c:[...omissis...]afxwin.h(2088): error C2065: 'GC_ALLGESTURES': undeclared identifier
1>c:[...omissis...]afxwin.h(2030): error C2065: 'GID_ZOOM': undeclared identifier
1>c:[...omissis...]afxwin.h(2030): error C2065: 'GC_ZOOM': undeclared identifier
1>c:[...omissis...]afxwin.h(2036): error C2065: 'GID_ROTATE': undeclared identifier
1>c:[...omissis...]afxwin.h(2036): error C2065: 'GC_ROTATE': undeclared identifier
1>c:[...omissis...]afxwin.h(2042): error C2065: 'GID_TWOFINGERTAP': undeclared identifier
1>c:[...omissis...]afxwin.h(2042): error C2065: 'GC_TWOFINGERTAP': undeclared identifier
1>c:[...omissis...]afxwin.h(2056): error C2065: 'GID_PAN': undeclared identifier
1>c:[...omissis...]afxwin.h(2056): error C2065: 'GC_PAN': undeclared identifier
1>c:[...omissis...]afxwin.h(2062): error C2065: 'GID_PAN': undeclared identifier
1>c:[...omissis...]afxwin.h(2062): error C2065: 'GC_PAN_WITH_SINGLE_FINGER_VERTICALLY': undeclared identifier
1>c:[...omissis...]afxwin.h(2068): error C2065: 'GID_PAN': undeclared identifier
1>c:[...omissis...]afxwin.h(2068): error C2065: 'GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY': undeclared identifier
1>c:[...omissis...]afxwin.h(2074): error C2065: 'GID_PAN': undeclared identifier
1>c:[...omissis...]afxw
in.h(2074): error C2065: 'GC_PAN_WITH_GUTTER': undeclared identifier
1>c:[...omissis...]afxwin.h(2080): error C2065: 'GID_PAN': undeclared identifier
1>c:[...omissis...]afxwin.h(2080): error C2065: 'GC_PAN_WITH_INERTIA': undeclared identifier
1>c:[...omissis...]afxwin.h(2964): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:[...omissis...]afxwin.h(2964): error C3646: 'GetCurrentGestureInfo': unknown override specifier
1>c:[...omissis...]afxwin.h(2964): error C2059: syntax error: ')'
1>c:[...omissis...]afxwin.h(2965): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>c:[...omissis...]afxwin.h(3020): error C2061: syntax error: identifier 'PTOUCHINPUT'
1>c:[...omissis...]afxwin.h(3030): error C2061: syntax error: identifier 'PTOUCHINPUT'
1>c:[...omissis...]afxwin.h(3043): error C3646: 'm_pCurrentGestureInfo': unknown override specifier
1>c:[...omissis...]afxwin.h(3043): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:[...omissis...]afxwin.h(4141): error C2061: syntax error: identifier 'TBPFLAG'
1>c:[...omissis...]afxwin.h(5447): error C2143: syntax error: missing ';' before '*'
1>c:[...omissis...]afxwin.h(5447): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:[...omissis...]afxwin.h(5447): error C2238: unexpected token(s) preceding ';'
1>c:[...omissis...]afxglobals.h(315): error C2143: syntax error: missing ';' before '*'
1>c:[...omissis...]afxglobals.h(315): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:[...omissis...]afxglobals.h(315): error C2238: unexpected token(s) preceding ';'
1>c:[...omissis...]afxadv.h(244): error C2143: syntax error: missing ';' before '*'
1>c:[...omissis...]afxadv.h(244): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:[...omissis...]afxadv.h(245): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>c:[...omissis...]afxadv.h(314): error C2061: syntax error: identifier 'KNOWNDESTCATEGORY'
1>c:[...omissis...]afxadv.h(390): error C2065: 'ICustomDestinationList': undeclared identifier
1>c:[...omissis...]afxadv.h(390): error C2923: 'ATL::CComPtr': 'ICustomDestinationList' is not a valid template type argument for parameter 'T'
1>c:[...omissis...]afxadv.h(273): error C2039: 'AbortList': is not a member of 'ATL::_NoAddRefReleaseOnCComPtr<T>'
1>c:[...omissis...]afxadv.h(428): error C2065: 'IApplicationDestinations': undeclared identifier
1>c:[...omissis...]afxadv.h(428): error C2923: 'ATL::CComPtr': 'IApplicationDestinations' is not a valid template type argument for parameter 'T'
1>c:[...omissis...]afxadv.h(430): warning C4624: 'CAppDestinations': destructor was implicitly defined as deleted
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

已解决。Visual studio 2015继承了Visual studio 2009设置。删除包含文件夹

C: \Program Files\Microsoft SDK \Windows\v6.0A\包括

一切开始正常工作

在将2010年提前到2015年时也遇到了类似的问题。已将问题追踪到targetver.h文件。它定义的是旧版本的windows。用当前默认值替换了以前的所有定义。

target.h
   // delete everything here
   #include <SDKDDKVer.h>
-- end of target.h

也许这可以帮助您解决问题。在Visual Studio 2015中,默认情况下不再安装C++工具。取而代之的是,C++编译器、库和项目模板被移到了一个可选功能中。启动安装程序后,您可以选择"典型"或"自定义"安装;如果选择"Typical",则不能使用Visual Studio在C++中进行开发,因为只会安装托管语言和web开发工具。Visual Studio 2015中的设置更改影响C++开发人员