这是旧版C ++应用程序。它已从VS 6.0移植到VS2015,现在又移植到VS2017。在2017年,我通过菜单/资源向导添加了一个对话框。该对话框的行为导致ATL出现各种问题。 (下面的错误示例...)
c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\atlmfc\include\afxbutton.h(184): warning C4003: not enough actual parameters for macro 'SelectFont'
\afxbutton.h(184): error C2146: syntax error: missing ')' before identifier 'SelectObject'
\afxbutton.h(184): error C3646: 'SelectObject': unknown override specifier
\afxbutton.h(184): error C2146: syntax error: missing ')' before identifier 'pDC'
\afxbutton.h(184): error C2065: 'pDC': undeclared identifier
\afxbutton.h(184): error C2096: 'HFONT': A data member cannot be initialized with a parenthesized initializer
\afxbutton.h(184): error C2433: 'CMFCButton::HFONT': 'virtual' not permitted on data declarations
\afxbutton.h(184): error C2131: expression did not evaluate to a constant
\afxbutton.h(184): note: failure was caused by non-constant arguments or reference to a non-constant symbol
\afxbutton.h(184): note: see usage of 'pDC'
\afxbutton.h(184): error C2327: 'CMFCButton::HFONT': is not a type name, static, or enumerator
\afxbutton.h(184): error C2059: syntax error: ')'
\afxbutton.h(184): error C2091: function returns function
\afxbutton.h(203): error C2327: 'CMFCButton::HFONT': is not a type name, static, or enumerator
\afxfontcombobox.h(45): warning C4003: not enough actual parameters for macro 'SelectFont'
\afxfontcombobox.h(45): error C2146: syntax error: missing ')' before identifier 'SelectObject'
\afxfontcombobox.h(45): error C3646: 'SelectObject': unknown override specifier
\afxfontcombobox.h(45): error C2146: syntax error: missing ')' before identifier 'pDesc'
\afxfontcombobox.h(45): error C2065: 'pDesc': undeclared identifier
\afxfontcombobox.h(45): error C2096: 'HFONT': A data member cannot be initialized with a parenthesized initializer
\afxfontcombobox.h(45): error C2131: expression did not evaluate to a constant
\afxfontcombobox.h(45): note: failure was caused by non-constant arguments or reference to a non-constant symbol
\afxfontcombobox.h(45): note: see usage of 'pDesc'
\afxfontcombobox.h(45): error C2327: 'CMFCFontComboBox::HFONT': is not a type name, static, or enumerator
\afxfontcombobox.h(45): error C2059: syntax error: ')'
\afxfontcombobox.h(45): error C2091: function returns function
\afxfontcombobox.h(46): error C2146: syntax error: missing ')' before identifier 'SelectObject'
\afxfontcombobox.h(46): error C3646: 'SelectObject': unknown override specifier
\afxfontcombobox.h(46): error C2146: syntax error: missing ')' before identifier 'lpszName'
\afxfontcombobox.h(46): error C2065: 'lpszName': undeclared identifier
\afxfontcombobox.h(46): error C2096: 'HFONT': A data member cannot be initialized with a parenthesized initializer
\afxfontcombobox.h(46): error C2086: 'BOOL CMFCFontComboBox::HFONT': redefinition
\afxfontcombobox.h(45): note: see declaration of 'CMFCFontComboBox::HFONT'
\afxfontcombobox.h(46): error C2131: expression did not evaluate to a constant
\afxfontcombobox.h(46): note: failure was caused by non-constant arguments or reference to a non-constant symbol
\afxfontcombobox.h(46): note: see usage of 'lpszName'
\afxfontcombobox.h(46): error C2327: 'CMFCFontComboBox::HFONT': is not a type name, static, or enumerator
\afxfontcombobox.h(46): error C2059: syntax error: ')'
罪魁祸首是#include“ afxcontrolbars.h”,它由IDE自动添加。不知道我是否必须链接到另一个版本的ATL,更改包含顺序或其他内容。有人有主意吗?
答案 0 :(得分:0)
我将#include“ afxcontrolbars.h”移到了其他任何afx之前,这解决了这个问题。