error LNK2005: "class _com_ptr_t<class _com_IIID<struct _Connection,&struct __s_GUID  _GUID_00000550_0000_0010_8000_00aa006d2ea4> >  m_pConnection" (?m_pConnection@@3V?$_com_ptr_t@V?$_com_IIID@U_Connection@@$1?_GUID_00000550_0000_0010_
8000_00aa006d2ea4@@3U__s_GUID@@A@@@@A) already defined in LeftView.obj
MyMail.obj : error LNK2005: "class _com_ptr_t<class _com_IIID<struct _Connection,&struct __s_GUID  _GUID_00000550_0000_0010_8000_00aa006d2ea4> >  m_pConnection" (?m_pConnection@@3V?$_com_ptr_t@V?$_com_IIID@U_Connection@@$1?_GUID_00000550_0000_0010_8
000_00aa006d2ea4@@3U__s_GUID@@A@@@@A) already defined in LeftView.obj
MyMailDoc.obj : error LNK2005: "class _com_ptr_t<class _com_IIID<struct _Connection,&struct __s_GUID  _GUID_00000550_0000_0010_8000_00aa006d2ea4> >  m_pConnection" (?m_pConnection@@3V?$_com_ptr_t@V?$_com_IIID@U_Connection@@$1?_GUID_00000550_0000_001
0_8000_00aa006d2ea4@@3U__s_GUID@@A@@@@A) already defined in LeftView.obj
MyMailView.obj : error LNK2005: "class _com_ptr_t<class _com_IIID<struct _Connection,&struct __s_GUID  _GUID_00000550_0000_0010_8000_00aa006d2ea4> >  m_pConnection" (?m_pConnection@@3V?$_com_ptr_t@V?$_com_IIID@U_Connection@@$1?_GUID_00000550_0000_00
10_8000_00aa006d2ea4@@3U__s_GUID@@A@@@@A) already defined in LeftView.obj
TopView.obj : error LNK2005: "class _com_ptr_t<class _com_IIID<struct _Connection,&struct __s_GUID  _GUID_00000550_0000_0010_8000_00aa006d2ea4> >  m_pConnection" (?m_pConnection@@3V?$_com_ptr_t@V?$_com_IIID@U_Connection@@$1?_GUID_00000550_0000_0010_
8000_00aa006d2ea4@@3U__s_GUID@@A@@@@A) already defined in LeftView.obj
Release/MyMail.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
Creating browse info file...MyMail.exe - 6 error(s), 2 warning(s)

解决方案 »

  1.   

    这是一个ADO的单文档程序,我想出现问题的可能原因是这样的。
    如果是对话框程序,将#import "D:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
    放在stdafx.h文件中,可是我现在是单文档程序,是不是就不能把这句放在stdafx中了,引起重复?如果是这样,那又应该怎么改呢?我需要把这句作为全局用的。因为我定义的数据连接变量是全局变量。
      

  2.   

    我知道是重复定义呀,怎么改?
    我现在明白了,不能把_ConnectionPtr m_pConnection;
    放在AppName.h(主程序文件)中,放在appname.h终究会出现这个问题,我现在把这个定义放到appName.cpp中,可是pConnection有已经不是全局变量了。
      

  3.   

    关注有分。
    UP,GZ,XX有分
      

  4.   

    可是pConnection有已经不是全局变量了。
    ___________
    全局变量这么用:
    A.CPP
    ConnectionPtr m_pConnection;
    ..........
    ___
    B.CPP
    extern ConnectionPtr m_pConnection;OK,可以用了
      

  5.   

    不可能是因为单文档而造成的
    以前我也用过
    ConnectionPtr 也是全局的现在找不到例子了,等找到了给你一个,:)