error LNK2005怎么解决呀?

jinling4388 2009-06-10 01:15:50
错误信息如下:
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) 已经在 QQDLL.obj 中定义
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) 已经在 QQDLL.obj 中定义
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) 已经在 QQDLL.obj 中定义
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: char const * __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::c_str(void)const " (?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) 已经在 QQDLL.obj 中定义
1>nafxcw.lib(appcore.obj) : error LNK2005: "protected: static struct AFX_MSGMAP const * __stdcall CWinApp::GetThisMessageMap(void)" (?GetThisMessageMap@CWinApp@@KGPBUAFX_MSGMAP@@XZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(appcore.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::InitApplication(void)" (?InitApplication@CWinApp@@UAEHXZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(appcore.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::ExitInstance(void)" (?ExitInstance@CWinApp@@UAEHXZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(appcore.obj) : error LNK2005: "public: virtual long __thiscall CWinApp::ProcessWndProcException(class CException *,struct tagMSG const *)" (?ProcessWndProcException@CWinApp@@UAEJPAVCException@@PBUtagMSG@@@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(appcore.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::OnIdle(long)" (?OnIdle@CWinApp@@UAEHJ@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(appcore.obj) : error LNK2005: "public: virtual struct CRuntimeClass * __thiscall CWinApp::GetRuntimeClass(void)const " (?GetRuntimeClass@CWinApp@@UBEPAUCRuntimeClass@@XZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(appcore.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::LoadSysPolicies(void)" (?LoadSysPolicies@CWinApp@@UAEHXZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(appcore.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::InitInstance(void)" (?InitInstance@CWinApp@@UAEHXZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(appcore.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::Run(void)" (?Run@CWinApp@@UAEHXZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(appcore.obj) : error LNK2005: "public: virtual void __thiscall CWinApp::WinHelpInternal(unsigned long,unsigned int)" (?WinHelpInternal@CWinApp@@UAEXKI@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(appcore.obj) : error LNK2005: "public: virtual struct HINSTANCE__ * __thiscall CWinApp::LoadAppLangResourceDLL(void)" (?LoadAppLangResourceDLL@CWinApp@@UAEPAUHINSTANCE__@@XZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(appcore.obj) : error LNK2005: "public: virtual __thiscall CWinApp::~CWinApp(void)" (??1CWinApp@@UAE@XZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(appui.obj) : error LNK2005: "public: virtual void __thiscall CWinApp::DoWaitCursor(int)" (?DoWaitCursor@CWinApp@@UAEXH@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(appui.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::SaveAllModified(void)" (?SaveAllModified@CWinApp@@UAEHXZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual void __thiscall CWinThread::Delete(void)" (?Delete@CWinThread@@UAEXXZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::IsIdleMessage(struct tagMSG *)" (?IsIdleMessage@CWinThread@@UAEHPAUtagMSG@@@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::PreTranslateMessage(struct tagMSG *)" (?PreTranslateMessage@CWinThread@@UAEHPAUtagMSG@@@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual class CWnd * __thiscall CWinThread::GetMainWnd(void)" (?GetMainWnd@CWinThread@@UAEPAVCWnd@@XZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::ProcessMessageFilter(int,struct tagMSG *)" (?ProcessMessageFilter@CWinThread@@UAEHHPAUtagMSG@@@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::PumpMessage(void)" (?PumpMessage@CWinThread@@UAEHXZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(except.obj) : error LNK2005: "void __stdcall AfxThrowMemoryException(void)" (?AfxThrowMemoryException@@YGXXZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "public: virtual int __thiscall CCmdTarget::OnCmdMsg(unsigned int,int,void *,struct AFX_CMDHANDLERINFO *)" (?OnCmdMsg@CCmdTarget@@UAEHIHPAXPAUAFX_CMDHANDLERINFO@@@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "public: virtual int __thiscall CCmdTarget::IsInvokeAllowed(long)" (?IsInvokeAllowed@CCmdTarget@@UAEHJ@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "public: virtual int __thiscall CCmdTarget::GetDispatchIID(struct _GUID *)" (?GetDispatchIID@CCmdTarget@@UAEHPAU_GUID@@@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "public: virtual unsigned int __thiscall CCmdTarget::GetTypeInfoCount(void)" (?GetTypeInfoCount@CCmdTarget@@UAEIXZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
...全文
4429 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
http://www.cnblogs.com/hyamw/archive/2007/01/11/618021.html

链接错误error LNK2005可能原因之
  • 打赏
  • 举报
回复
http://www.cnblogs.com/hyamw/archive/2007/01/11/618021.html

链接错误error LNK2005可能原因之
jinling4388 2009-06-12
  • 打赏
  • 举报
回复
现在的编译选项就是:/MT /MTd

选择,在共享DLL中使用MFC。编译时通过了,但是我的HOOK根本安装不了了。也就是说这样功能不能实现。
amossavez 2009-06-12
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 Loaden 的回复:]
修改编译选项:/MT /MTd
[/Quote]
你尝试着看看
老邓 2009-06-12
  • 打赏
  • 举报
回复
修改编译选项:/MT /MTd
goodname 2009-06-12
  • 打赏
  • 举报
回复
既然你用到MFC了,那么是否对MFC的使用也是一致的.

可以选择,在共享DLL中使用MFC
jinling4388 2009-06-11
  • 打赏
  • 举报
回复
我编译的是一个DLL,属性是DEBUG版用的/MTd,RELEASE版用的是/MT。这样有问题吗?VS2008下编译,没有/ML、/MLd、/LD和/LDd。
库应该是一致的吧?
goodname 2009-06-10
  • 打赏
  • 举报
回复
应该使用一致的运行时库,我一直这么认为。
jinling4388 2009-06-10
  • 打赏
  • 举报
回复
竟然加了字数限制。错误补充:
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "public: virtual class CTypeLibCache * __thiscall CCmdTarget::GetTypeLibCache(void)" (?GetTypeLibCache@CCmdTarget@@UAEPAVCTypeLibCache@@XZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "public: virtual long __thiscall CCmdTarget::GetTypeLib(unsigned long,struct ITypeLib * *)" (?GetTypeLib@CCmdTarget@@UAEJKPAPAUITypeLib@@@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "protected: virtual struct AFX_DISPMAP const * __thiscall CCmdTarget::GetDispatchMap(void)const " (?GetDispatchMap@CCmdTarget@@MBEPBUAFX_DISPMAP@@XZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "protected: virtual struct AFX_EVENTSINKMAP const * __thiscall CCmdTarget::GetEventSinkMap(void)const " (?GetEventSinkMap@CCmdTarget@@MBEPBUAFX_EVENTSINKMAP@@XZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "protected: virtual struct AFX_INTERFACEMAP const * __thiscall CCmdTarget::GetInterfaceMap(void)const " (?GetInterfaceMap@CCmdTarget@@MBEPBUAFX_INTERFACEMAP@@XZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "public: virtual void __thiscall CCmdTarget::OnFinalRelease(void)" (?OnFinalRelease@CCmdTarget@@UAEXXZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "public: virtual int __thiscall CCmdTarget::OnCreateAggregates(void)" (?OnCreateAggregates@CCmdTarget@@UAEHXZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "public: virtual struct IUnknown * __thiscall CCmdTarget::GetInterfaceHook(void const *)" (?GetInterfaceHook@CCmdTarget@@UAEPAUIUnknown@@PBX@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "protected: virtual struct AFX_CONNECTIONMAP const * __thiscall CCmdTarget::GetConnectionMap(void)const " (?GetConnectionMap@CCmdTarget@@MBEPBUAFX_CONNECTIONMAP@@XZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "protected: virtual struct IConnectionPoint * __thiscall CCmdTarget::GetConnectionHook(struct _GUID const &)" (?GetConnectionHook@CCmdTarget@@MAEPAUIConnectionPoint@@ABU_GUID@@@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "protected: virtual int __thiscall CCmdTarget::GetExtraConnectionPoints(class CPtrArray *)" (?GetExtraConnectionPoints@CCmdTarget@@MAEHPAVCPtrArray@@@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(cmdtarg.obj) : error LNK2005: "protected: virtual struct AFX_OLECMDMAP const * __thiscall CCmdTarget::GetCommandMap(void)const " (?GetCommandMap@CCmdTarget@@MBEPBUAFX_OLECMDMAP@@XZ) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>nafxcw.lib(winstr.obj) : error LNK2005: "struct HINSTANCE__ * __stdcall AfxFindStringResourceHandle(unsigned int)" (?AfxFindStringResourceHandle@@YGPAUHINSTANCE__@@I@Z) 已经在 mfc90u.lib(mfc90u.dll) 中定义
1>libcmt.lib(crt0dat.obj) : error LNK2005: __amsg_exit 已经在 msvcrt.lib(MSVCR90.dll) 中定义
1>libcmt.lib(crt0dat.obj) : error LNK2005: __initterm_e 已经在 msvcrt.lib(MSVCR90.dll) 中定义
1>libcmt.lib(invarg.obj) : error LNK2005: __invalid_parameter_noinfo 已经在 msvcrt.lib(MSVCR90.dll) 中定义
1>libcmt.lib(crt0init.obj) : error LNK2005: ___xi_a 已经在 msvcrt.lib(cinitexe.obj) 中定义
1>libcmt.lib(crt0init.obj) : error LNK2005: ___xi_z 已经在 msvcrt.lib(cinitexe.obj) 中定义
1>libcmt.lib(crt0init.obj) : error LNK2005: ___xc_a 已经在 msvcrt.lib(cinitexe.obj) 中定义
1>libcmt.lib(crt0init.obj) : error LNK2005: ___xc_z 已经在 msvcrt.lib(cinitexe.obj) 中定义
1>libcmt.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) 已经在 msvcrt.lib(MSVCR90.dll) 中定义
1>libcmt.lib(winxfltr.obj) : error LNK2005: ___CppXcptFilter 已经在 msvcrt.lib(MSVCR90.dll) 中定义
1>libcmt.lib(tidtable.obj) : error LNK2005: __encode_pointer 已经在 msvcrt.lib(MSVCR90.dll) 中定义
1>libcmt.lib(tidtable.obj) : error LNK2005: __encoded_null 已经在 msvcrt.lib(MSVCR90.dll) 中定义
1>libcmt.lib(tidtable.obj) : error LNK2005: __decode_pointer 已经在 msvcrt.lib(MSVCR90.dll) 中定义
1>libcmt.lib(crtheap.obj) : error LNK2005: __malloc_crt 已经在 msvcrt.lib(MSVCR90.dll) 中定义
1>libcmt.lib(mlock.obj) : error LNK2005: __unlock 已经在 msvcrt.lib(MSVCR90.dll) 中定义
1>libcmt.lib(mlock.obj) : error LNK2005: __lock 已经在 msvcrt.lib(MSVCR90.dll) 中定义
1>msvcrt.lib(MSVCR90.dll) : error LNK2005: _memmove 已经在 libcmt.lib(memmove.obj) 中定义
1> 正在创建库 ..\ssnmate\Release\QQDLL.lib 和对象 ..\ssnmate\Release\QQDLL.exp
1>LINK : warning LNK4098: 默认库“msvcrt.lib”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
1>LINK : warning LNK4098: 默认库“nafxcw.lib”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
1>LINK : warning LNK4098: 默认库“libcmt.lib”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
1>libcmt.lib(crt0.obj) : error LNK2019: 无法解析的外部符号 _main,该符号在函数 ___tmainCRTStartup 中被引用
1>..\ssnmate\Release\QQDLL.dll : fatal error LNK1120: 1 个无法解析的外部命令

24,855

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧