免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1717 | 回复: 0
打印 上一主题 下一主题

一个MFC的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-11-27 21:12 |只看该作者 |倒序浏览
编译时老是出现这个错误:
Deleting intermediate files and output files for project 'Info - Win32 Debug'.
--------------------Configuration: Info - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
Info.cpp
e:\project_info\info\information.h(7) : error C2535: 'struct CRuntimeClass *__stdcall CInfo::_GetBaseClass(void)' : member function already defined or declared
        e:\project_info\info\information.h(6) : see declaration of '_GetBaseClass'
e:\project_info\info\information.h(7) : error C2373: 'classCInfo' : redefinition; different type modifiers
        e:\project_info\info\information.h(6) : see declaration of 'classCInfo'
e:\project_info\info\information.h(7) : error C2535: 'struct CRuntimeClass *__thiscall CInfo::GetRuntimeClass(void) const' : member function already defined or declared
        e:\project_info\info\information.h(6) : see declaration of 'GetRuntimeClass'
e:\project_info\info\information.h(7) : error C2535: 'class CObject *__stdcall CInfo::CreateObject(void)' : member function already defined or declared
        e:\project_info\info\information.h(6) : see declaration of 'CreateObject'
InfoDoc.cpp
e:\project_info\info\information.h(7) : error C2535: 'struct CRuntimeClass *__stdcall CInfo::_GetBaseClass(void)' : member function already defined or declared
        e:\project_info\info\information.h(6) : see declaration of '_GetBaseClass'
e:\project_info\info\information.h(7) : error C2373: 'classCInfo' : redefinition; different type modifiers
        e:\project_info\info\information.h(6) : see declaration of 'classCInfo'
e:\project_info\info\information.h(7) : error C2535: 'struct CRuntimeClass *__thiscall CInfo::GetRuntimeClass(void) const' : member function already defined or declared
        e:\project_info\info\information.h(6) : see declaration of 'GetRuntimeClass'
e:\project_info\info\information.h(7) : error C2535: 'class CObject *__stdcall CInfo::CreateObject(void)' : member function already defined or declared
        e:\project_info\info\information.h(6) : see declaration of 'CreateObject'
E:\Project_Info\Info\InfoDoc.cpp(61) : error C2678: binary '<<' : no operator defined which takes a left-hand operand of type 'class CArchive' (or there is no acceptable conversion)
E:\Project_Info\Info\InfoDoc.cpp(65) : error C2679: binary '>;>;' : no operator defined which takes a right-hand operand of type 'class CObList' (or there is no acceptable conversion)
Information.cpp
e:\project_info\info\information.h(7) : error C2535: 'struct CRuntimeClass *__stdcall CInfo::_GetBaseClass(void)' : member function already defined or declared
        e:\project_info\info\information.h(6) : see declaration of '_GetBaseClass'
e:\project_info\info\information.h(7) : error C2373: 'classCInfo' : redefinition; different type modifiers
        e:\project_info\info\information.h(6) : see declaration of 'classCInfo'
e:\project_info\info\information.h(7) : error C2535: 'struct CRuntimeClass *__thiscall CInfo::GetRuntimeClass(void) const' : member function already defined or declared
        e:\project_info\info\information.h(6) : see declaration of 'GetRuntimeClass'
e:\project_info\info\information.h(7) : error C2535: 'class CObject *__stdcall CInfo::CreateObject(void)' : member function already defined or declared
        e:\project_info\info\information.h(6) : see declaration of 'CreateObject'
E:\Project_Info\Info\Information.cpp(4) : error C2512: 'CInfo' : no appropriate default constructor available
E:\Project_Info\Info\Information.cpp(5) : warning C4003: not enough actual parameters for macro 'IMPLEMENT_SERIAL'
E:\Project_Info\Info\Information.cpp(5) : warning C4003: not enough actual parameters for macro '_IMPLEMENT_RUNTIMECLASS'
E:\Project_Info\Info\Information.cpp(5) : error C2084: function 'class CObject *__stdcall CInfo::CreateObject(void)' already has a body
E:\Project_Info\Info\Information.cpp(5) : error C2512: 'CInfo' : no appropriate default constructor available
E:\Project_Info\Info\Information.cpp(5) : error C2084: function 'struct CRuntimeClass *__stdcall CInfo::_GetBaseClass(void)' already has a body
E:\Project_Info\Info\Information.cpp(5) : error C2373: 'public: static struct CRuntimeClass const CInfo::classCInfo' : redefinition; different type modifiers
        e:\project_info\info\information.h(6) : see declaration of 'public: static struct CRuntimeClass const CInfo::classCInfo'
E:\Project_Info\Info\Information.cpp(5) : fatal error C1903: unable to recover from previous error(s); stopping compilation
InfoView.cpp
e:\project_info\info\information.h(7) : error C2535: 'struct CRuntimeClass *__stdcall CInfo::_GetBaseClass(void)' : member function already defined or declared
        e:\project_info\info\information.h(6) : see declaration of '_GetBaseClass'
e:\project_info\info\information.h(7) : error C2373: 'classCInfo' : redefinition; different type modifiers
        e:\project_info\info\information.h(6) : see declaration of 'classCInfo'
e:\project_info\info\information.h(7) : error C2535: 'struct CRuntimeClass *__thiscall CInfo::GetRuntimeClass(void) const' : member function already defined or declared
        e:\project_info\info\information.h(6) : see declaration of 'GetRuntimeClass'
e:\project_info\info\information.h(7) : error C2535: 'class CObject *__stdcall CInfo::CreateObject(void)' : member function already defined or declared
        e:\project_info\info\information.h(6) : see declaration of 'CreateObject'
MainFrm.cpp
Generating Code...
Error executing cl.exe.

Info.exe - 24 error(s), 2 warning(s)




这是Information.h

#ifndef CPP_INFO
#define CPP_INFO

class CInfo:public CObject
{
        DECLARE_DYNCREATE(CInfo)
        DECLARE_SERIAL(CInfo)
public:
        CString m_strName;
        CString m_strAddress;
        CString m_strPhone;
        CString m_strMobile;
        CString m_strEmail;
       
        CInfo::CInfo(CString name, CString address, CString phone, CString mobile, CString email);
       
        void Serialize(CArchive &ar);       
#ifdef _DEBUG
        void Dump(CDumpContext &dc) const;
#endif
};

#endif

请问那里有错阿???是不是这两个DECLARE_DYNCREATE(CInfo)和
        DECLARE_SERIAL(CInfo) macro使用有错??不会吧。在.cpp里都有相应的IMPLEMENT_....
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP