标题:VS2010 MFC程序编译报错,感觉很离奇
只看楼主
nandiin
Rank: 2
等 级:论坛游民
帖 子:29
专家分:25
注 册:2013-2-28
结帖率:100%
已结贴  问题点数:5 回复次数:6 
VS2010 MFC程序编译报错,感觉很离奇
用VS2010新建了一个MFC Application 新建导向全是默认的(除了选成了单文档之外)  然后Build就报了这么一大串错误,感觉有些头文件都编译不过去,有哪位达人能解答一下吗?
------ Build started: Project: MFCTest, Configuration: Debug Win32 ------
1>  stdafx.cpp
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(137): error C2011: 'CSize' : 'class' type redefinition
1>          d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atltypes.h(26) : see declaration of 'CSize'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(176): error C2011: 'CPoint' : 'class' type redefinition
1>          d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atltypes.h(69) : see declaration of 'CPoint'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(225): error C2011: 'CRect' : 'class' type redefinition
1>          d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atltypes.h(125) : see declaration of 'CRect'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(3195): error C2079: 'CFrameWnd::m_rectBorder' uses undefined class 'CRect'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(3741): error C2079: 'CScrollView::m_totalLog' uses undefined class 'CSize'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(3742): error C2079: 'CScrollView::m_totalDev' uses undefined class 'CSize'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(3743): error C2079: 'CScrollView::m_pageDev' uses undefined class 'CSize'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(3744): error C2079: 'CScrollView::m_lineDev' uses undefined class 'CSize'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\include\afxwin.h(3870): error C2079: 'CWinThread::m_ptCursorLast' uses undefined class 'CPoint'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(506): error C2061: syntax error : identifier 'FileDialogEvents'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(507): error C2144: syntax error : 'int' should be preceded by ';'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(507): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(507): warning C4183: 'BEGIN_INTERFACE_PART': missing return type; assumed to be a member function returning 'int'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(507): error C2143: syntax error : missing ';' before '__stdcall'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(507): error C2433: 'CFileDialog::HRESULT' : 'virtual' not permitted on data declarations
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(507): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(507): error C2495: 'CFileDialog::HRESULT' : '__declspec(nothrow)' can only be applied to function declarations or definitions
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(507): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(507): warning C4183: 'OnFileOk': missing return type; assumed to be a member function returning 'int'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(515): error C2061: syntax error : identifier 'FileDialogEvents'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(517): error C3646: 'BEGIN_INTERFACE_PART' : unknown override specifier
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(517): error C2061: syntax error : identifier 'FileDialogControlEvents'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(518): error C2091: function returns function
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(518): error C2144: syntax error : 'int' should be preceded by ';'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(518): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(518): warning C4183: 'END_INTERFACE_PART_OPTIONAL': missing return type; assumed to be a member function returning 'int'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(518): error C2143: syntax error : missing ';' before '__stdcall'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(518): error C2433: 'CFileDialog::HRESULT' : 'virtual' not permitted on data declarations
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(518): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(518): error C2495: 'CFileDialog::HRESULT' : '__declspec(nothrow)' can only be applied to function declarations or definitions
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(518): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(518): warning C4183: 'OnItemSelected': missing return type; assumed to be a member function returning 'int'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(522): error C2061: syntax error : identifier 'FileDialogControlEvents'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(534): error C2143: syntax error : missing ';' before 'private'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(534): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(534): error C2556: 'int CFileDialog::END_INTERFACE_PART_OPTIONAL(void)' : overloaded function differs only by return type from 'int (__cdecl *CFileDialog::END_INTERFACE_PART_OPTIONAL(void))(void)'
1>          d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(515) : see declaration of 'CFileDialog::END_INTERFACE_PART_OPTIONAL'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(534): error C2040: 'CFileDialog::END_INTERFACE_PART_OPTIONAL' : 'int (void)' differs in levels of indirection from 'int (__cdecl *(void))(void)'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxdlgs.h(534): warning C4183: 'END_INTERFACE_PART_OPTIONAL': missing return type; assumed to be a member function returning 'int'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxext.h(432): error C2079: 'CToolBar::m_sizeImage' uses undefined class 'CSize'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxext.h(433): error C2079: 'CToolBar::m_sizeButton' uses undefined class 'CSize'
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxext.h(375): error C3861: 'CRect': identifier not found
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxext.h(375): error C2440: 'default argument' : cannot convert from 'CRect' to 'CRect'
1>          Source or target has incomplete type
1>d:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxext.h(463): fatal error C1903: unable to recover from previous error(s); stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
搜索更多相关主题的帖子: microsoft studio include started visual 
2013-03-01 11:11
yuccn
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:何方
等 级:版主
威 望:167
帖 子:6809
专家分:42393
注 册:2010-12-16
得分:4 
没有吧,你勾选的是什么东西,默认你选中的是什么,看看贴出来大家分析下

我行我乐
我的博客:
http://blog.yuccn. net
2013-03-01 12:09
nandiin
Rank: 2
等 级:论坛游民
帖 子:29
专家分:25
注 册:2013-2-28
得分:0 
2013-03-01 16:26
nandiin
Rank: 2
等 级:论坛游民
帖 子:29
专家分:25
注 册:2013-2-28
得分:0 
回复 2楼 yuccn
已贴图,望指点
2013-03-01 16:27
yuccn
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:何方
等 级:版主
威 望:167
帖 子:6809
专家分:42393
注 册:2010-12-16
得分:0 
按照你的那个配置,我这边是可以的。这样,估计就是环境的问题了

你把vs2010修复安装一次看看,记得不MFC 、 atlmfc 等(或者和vc相关的都勾上)勾上,修复下,估计是你上次安装不够完整吧

我行我乐
我的博客:
http://blog.yuccn. net
2013-03-01 16:55
nandiin
Rank: 2
等 级:论坛游民
帖 子:29
专家分:25
注 册:2013-2-28
得分:0 
回复 5楼 yuccn
我记得安装的时候选的是完全安装,正在重新安装,希望好使
2013-03-04 23:42
nandiin
Rank: 2
等 级:论坛游民
帖 子:29
专家分:25
注 册:2013-2-28
得分:0 
还是那样啊    为什么头文件会报重定义的错误呢····
2013-03-05 14:06



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-399453-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.209206 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved