在已经安装了VS2008的计算机上安装VS2010,用VS2010新建一个MFC程序,编译都通不过,错误如下:
1> stdafx.cpp
1>d:/program files/microsoft visual studio 10.0/vc/atlmfc/include/afxglobals.h(375): error C2143: syntax error : missing ';' before '*'
1>d:/program files/microsoft visual studio 10.0/vc/atlmfc/include/afxglobals.h(375): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:/program files/microsoft visual studio 10.0/vc/atlmfc/include/afxglobals.h(375): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:/program files/microsoft visual studio 10.0/vc/atlmfc/include/afxglobals.h(375): warning C4183: 'GetITaskbarList3': missing return type; assumed to be a member function returning 'int'
1>d:/program files/microsoft visual studio 10.0/vc/atlmfc/include/afxglobals.h(413): error C2143: syntax error : missing ';' before '*'
1>d:/program files/microsoft visual studio 10.0/vc/atlmfc/include/afxglobals.h(413): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:/program files/microsoft visual studio 10.0/vc/atlmfc/include/afxglobals.h(413): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
查看错误文件,发现ITaskbarList3没有定义,出现这种问题最大的可能就是包含目录的问题。
检查VC包含目录发现,这里包含的目录都是继承于VS2008的,因此需要修改:
1. 菜单View--> Property Manager
2. 在属性管理界面上展开当前工程,选择debug或者release下的Microsoft.Cpp.Win32.user,双击打开属性对话框
3. 查看VC Directories下面的设置,发现引用的SDK是6.0版本,我们需要修改为v7.0A版本
4. 修改保存后,整个VS2010的默认设置就修改了,该文件保存在%User%/AppData/Local/Microsoft/MSBuild/v4.0目录下。
修改后,程序就可以编译成功了。
本文由VS软件圈(vssoft.net)发布,不代表VS软件圈立场,转载联系作者并注明出处:https://vssoft.net/vsazwt/VS2010anzhuangwenti/2020/0724/2473.html