有出现了:无法解析的外部符号

jinling4388 2009-06-05 10:13:46
我的程序中有一个类,类的成员静态函数static BOOL Speech(CString szMes, DWORD dwParam)调用其他工程的静态函数了。然后编译链接没有任何问题。
但是,当我的程序中其他函数调Speech(…,…)时,却给我返回了“无法解析的外部符号”的链接错误。这是为什么呢?我的程序的编译选项是完全一样的,不是因为没包含库文件引起的。
...全文
2790 30 打赏 收藏 转发到动态 举报
写回复
用AI写文章
30 条回复
切换为时间正序
请发表友善的回复…
发表回复
Tangjianhuahua 2011-04-30
  • 打赏
  • 举报
回复
检查一下你所调用的函数是不是已经实现了?因为你声明的时候可能是不是函数名字错了?检查一下声明的函数与对应的实现是否一致。
lgb31415926 2011-03-23
  • 打赏
  • 举报
回复
LZ解决了没有呢? 我似乎遇上了同样的一个问题.....
Jalien 2009-06-09
  • 打赏
  • 举报
回复
lz 你把那个static放在放在类外面试试,有时候不合理的inline会导致这种问题。我上次就遇到过,后来不用内联就没事了。详情请参考《More Effecitive C++》
sbwjl 2009-06-09
  • 打赏
  • 举报
回复
你自己把代码打下来,不要粘贴。
goodname 2009-06-09
  • 打赏
  • 举报
回复
这个哪个出的错,

描述一下你的调用架构

是不是你得obj使用mfc实现的?

既然有提示,你就在宏定义上加上_AFXDLL它。

这个应该你的dll需要动态链接到mfc的dll吧,猜的,我很多年不作mfc了,不记得细节了。
也许不对
jinling4388 2009-06-09
  • 打赏
  • 举报
回复
回复23楼:
现在包含obj之后就出现上面的错误了。

回复22楼:
那个我都该过,出错:
现在MTd,改成MDd。错误:1>d:\microsoft visual studio 9.0\vc\atlmfc\include\afx.h(24) : fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
scsnsjsl_cs_dn 2009-06-09
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 chenzhp 的回复:]
检查函数声明文件和定义文件参数是否一致
检查是否包含头文件
检测是否给出该函数的定义
如果是外部函数,是否包含了lib
[/Quote]
说得比较权了
goodname 2009-06-09
  • 打赏
  • 举报
回复
从你的出错信息来看,你使用的库或者和应用工程的编译条件之间似乎有不一致的地方,

这个编译条件主要是在属性对话框里面的的c/c++->代码生成->运行时库 这个地方
goodname 2009-06-09
  • 打赏
  • 举报
回复
如果你的这个obj还依赖别的文件的话,当然别的也要加入进来。

obj只是你对应源文件的目标文件,如果该源文件调用了别的源文件的函数,那么别的源文件的obj也许要包括进来。
jinling4388 2009-06-09
  • 打赏
  • 举报
回复
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "protected: virtual struct IConnectionPoint * __thiscall CCmdTarget::GetConnectionHook(struct _GUID const &)" (?GetConnectionHook@CCmdTarget@@MAEPAUIConnectionPoint@@ABU_GUID@@@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "protected: virtual int __thiscall CCmdTarget::GetExtraConnectionPoints(class CPtrArray *)" (?GetExtraConnectionPoints@CCmdTarget@@MAEHPAVCPtrArray@@@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "protected: virtual struct AFX_OLECMDMAP const * __thiscall CCmdTarget::GetCommandMap(void)const " (?GetCommandMap@CCmdTarget@@MBEPBUAFX_OLECMDMAP@@XZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(afxinl1.obj) : error LNK2005: "public: virtual void __thiscall CObject::Serialize(class CArchive &)" (?Serialize@CObject@@UAEXAAVCArchive@@@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(winocc.obj) : error LNK2005: "public: class CWnd * __thiscall CWnd::GetDlgItem(int)const " (?GetDlgItem@CWnd@@QBEPAV1@H@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(winstr.obj) : error LNK2005: "struct HINSTANCE__ * __stdcall AfxFindStringResourceHandle(unsigned int)" (?AfxFindStringResourceHandle@@YGPAUHINSTANCE__@@I@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(olemisc.obj) : error LNK2005: "void __stdcall AfxThrowOleException(long)" (?AfxThrowOleException@@YGXJ@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(strcore.obj) : error LNK2005: "struct ATL::IAtlStringMgr * __stdcall AfxGetStringManager(void)" (?AfxGetStringManager@@YGPAUIAtlStringMgr@ATL@@XZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appui2.obj) : error LNK2005: "public: virtual void __thiscall CWinApp::InitLibId(void)" (?InitLibId@CWinApp@@UAEXXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appui2.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::Register(void)" (?Register@CWinApp@@UAEHXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appui2.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::Unregister(void)" (?Unregister@CWinApp@@UAEHXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>libcmtd.lib(crt0dat.obj) : error LNK2005: __amsg_exit 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1>libcmtd.lib(crt0dat.obj) : error LNK2005: __initterm_e 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1>libcmtd.lib(dbgheap.obj) : error LNK2005: __malloc_dbg 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1>libcmtd.lib(dbgheap.obj) : error LNK2005: __free_dbg 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1>libcmtd.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1>libcmtd.lib(tidtable.obj) : error LNK2005: __encode_pointer 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1>libcmtd.lib(tidtable.obj) : error LNK2005: __encoded_null 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1>libcmtd.lib(tidtable.obj) : error LNK2005: __decode_pointer 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1>libcmtd.lib(invarg.obj) : error LNK2005: __invalid_parameter 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1>libcmtd.lib(crt0init.obj) : error LNK2005: ___xi_a 已经在 msvcrtd.lib(cinitexe.obj) 中定义
1>libcmtd.lib(crt0init.obj) : error LNK2005: ___xi_z 已经在 msvcrtd.lib(cinitexe.obj) 中定义
1>libcmtd.lib(crt0init.obj) : error LNK2005: ___xc_a 已经在 msvcrtd.lib(cinitexe.obj) 中定义
1>libcmtd.lib(crt0init.obj) : error LNK2005: ___xc_z 已经在 msvcrtd.lib(cinitexe.obj) 中定义
1>libcmtd.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1>libcmtd.lib(winxfltr.obj) : error LNK2005: ___CppXcptFilter 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1>libcmtd.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1>libcmtd.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1>libcmtd.lib(mlock.obj) : error LNK2005: __lock 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1>libcmtd.lib(mlock.obj) : error LNK2005: __unlock 已经在 msvcrtd.lib(MSVCR90D.dll) 中定义
1> 正在创建库 ..\ssnmate\Debug\QQDLL.lib 和对象 ..\ssnmate\Debug\QQDLL.exp
1>LINK : warning LNK4098: 默认库“msvcrtd.lib”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
1>LINK : warning LNK4098: 默认库“nafxcwd.lib”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
1>LINK : warning LNK4098: 默认库“libcmtd.lib”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
1>SpeechManager.obj : error LNK2019: 无法解析的外部符号 "public: static wchar_t const * __cdecl CAccEvent::GetEventString(unsigned long,int)" (?GetEventString@CAccEvent@@SAPB_WKH@Z),该符号在函数 "public: static int __cdecl CSpeechManager::AddEventSpeech(enum SPEAK_PRIORITY,unsigned long,class CSpeakItem *,class CSpeakItem *,class CSpeakItem *)" (?AddEventSpeech@CSpeechManager@@SAHW4SPEAK_PRIORITY@@KPAVCSpeakItem@@11@Z) 中被引用
1>SpeechManager.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall ISpeechLog::ISpeechLog(void)" (??0ISpeechLog@@QAE@XZ),该符号在函数 "public: class ISpeech * __thiscall CSpeechManager::GetDefaultSpeech(void)" (?GetDefaultSpeech@CSpeechManager@@QAEPAVISpeech@@XZ) 中被引用
1>SpeechManager.obj : error LNK2019: 无法解析的外部符号 "void __cdecl DebugMsg(wchar_t const *,...)" (?DebugMsg@@YAXPB_WZZ),该符号在函数 "public: class ISpeech * __thiscall CSpeechManager::GetDefaultSpeech(void)" (?GetDefaultSpeech@CSpeechManager@@QAEPAVISpeech@@XZ) 中被引用
1>SpeechManager.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall ISpeechIntersound::ISpeechIntersound(void)" (??0ISpeechIntersound@@QAE@XZ),该符号在函数 "public: class ISpeech * __thiscall CSpeechManager::GetDefaultSpeech(void)" (?GetDefaultSpeech@CSpeechManager@@QAEPAVISpeech@@XZ) 中被引用
1>QQDLL.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall CSpeakItem::CSpeakItem(char const *,int,struct TTS_PARAM *)" (??0CSpeakItem@@QAE@PBDHPAUTTS_PARAM@@@Z),该符号在函数 "public: static int __cdecl CSpeech::Speech(class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > >,unsigned long)" (?Speech@CSpeech@@SAHV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@K@Z) 中被引用
1>libcmtd.lib(crt0.obj) : error LNK2019: 无法解析的外部符号 _main,该符号在函数 ___tmainCRTStartup 中被引用
1>..\ssnmate\Debug\QQDLL.dll : fatal error LNK1120: 6 个无法解析的外部命令
jinling4388 2009-06-09
  • 打赏
  • 举报
回复
回复楼上的:我按你说的做了,错误更多了。

1>------ 已启动生成: 项目: QQDLL, 配置: Debug Win32 ------
1>正在链接...
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::_Container_base_secure::~_Container_base_secure(void)" (??1_Container_base_secure@std@@QAE@XZ) 已经在 QQDLL.obj 中定义
1>msvcprtd.lib(MSVCP90D.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>msvcprtd.lib(MSVCP90D.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>msvcprtd.lib(MSVCP90D.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>msvcprtd.lib(MSVCP90D.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>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::_Container_base_secure::_Container_base_secure(void)" (??0_Container_base_secure@std@@QAE@XZ) 已经在 QQDLL.obj 中定义
1>nafxcwd.lib(appcore.obj) : error LNK2005: "protected: static struct AFX_MSGMAP const * __stdcall CWinApp::GetThisMessageMap(void)" (?GetThisMessageMap@CWinApp@@KGPBUAFX_MSGMAP@@XZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appcore.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::LoadSysPolicies(void)" (?LoadSysPolicies@CWinApp@@UAEHXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appcore.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::InitApplication(void)" (?InitApplication@CWinApp@@UAEHXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appcore.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::InitInstance(void)" (?InitInstance@CWinApp@@UAEHXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appcore.obj) : error LNK2005: "public: virtual struct HINSTANCE__ * __thiscall CWinApp::LoadAppLangResourceDLL(void)" (?LoadAppLangResourceDLL@CWinApp@@UAEPAUHINSTANCE__@@XZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appcore.obj) : error LNK2005: "public: virtual __thiscall CWinApp::~CWinApp(void)" (??1CWinApp@@UAE@XZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appcore.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::ExitInstance(void)" (?ExitInstance@CWinApp@@UAEHXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appcore.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::Run(void)" (?Run@CWinApp@@UAEHXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appcore.obj) : error LNK2005: "public: virtual void __thiscall CWinApp::WinHelpInternal(unsigned long,unsigned int)" (?WinHelpInternal@CWinApp@@UAEXKI@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appcore.obj) : error LNK2005: "public: virtual long __thiscall CWinApp::ProcessWndProcException(class CException *,struct tagMSG const *)" (?ProcessWndProcException@CWinApp@@UAEJPAVCException@@PBUtagMSG@@@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appcore.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::OnIdle(long)" (?OnIdle@CWinApp@@UAEHJ@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appcore.obj) : error LNK2005: "public: virtual void __thiscall CWinApp::AssertValid(void)const " (?AssertValid@CWinApp@@UBEXXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appcore.obj) : error LNK2005: "public: virtual void __thiscall CWinApp::Dump(class CDumpContext &)const " (?Dump@CWinApp@@UBEXAAVCDumpContext@@@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appcore.obj) : error LNK2005: "public: virtual struct CRuntimeClass * __thiscall CWinApp::GetRuntimeClass(void)const " (?GetRuntimeClass@CWinApp@@UBEPAUCRuntimeClass@@XZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appui.obj) : error LNK2005: "public: virtual void __thiscall CWinApp::DoWaitCursor(int)" (?DoWaitCursor@CWinApp@@UAEXH@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(appui.obj) : error LNK2005: "public: virtual int __thiscall CWinApp::SaveAllModified(void)" (?SaveAllModified@CWinApp@@UAEHXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(afxinl2.obj) : error LNK2005: "class CWnd * __stdcall AfxGetMainWnd(void)" (?AfxGetMainWnd@@YGPAVCWnd@@XZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(afxmem.obj) : error LNK2005: "public: static void __stdcall CObject::operator delete(void *)" (??3CObject@@SGXPAX@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int,char const *,int)" (??_U@YAPAXIPBDH@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(thrdcore.obj) : error LNK2005: "public: virtual void __thiscall CWinThread::Delete(void)" (?Delete@CWinThread@@UAEXXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::IsIdleMessage(struct tagMSG *)" (?IsIdleMessage@CWinThread@@UAEHPAUtagMSG@@@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::PreTranslateMessage(struct tagMSG *)" (?PreTranslateMessage@CWinThread@@UAEHPAUtagMSG@@@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::ProcessMessageFilter(int,struct tagMSG *)" (?ProcessMessageFilter@CWinThread@@UAEHHPAUtagMSG@@@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(thrdcore.obj) : error LNK2005: "public: virtual class CWnd * __thiscall CWinThread::GetMainWnd(void)" (?GetMainWnd@CWinThread@@UAEPAVCWnd@@XZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::PumpMessage(void)" (?PumpMessage@CWinThread@@UAEHXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(except.obj) : error LNK2005: "void __stdcall AfxThrowMemoryException(void)" (?AfxThrowMemoryException@@YGXXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "public: virtual int __thiscall CCmdTarget::OnCmdMsg(unsigned int,int,void *,struct AFX_CMDHANDLERINFO *)" (?OnCmdMsg@CCmdTarget@@UAEHIHPAXPAUAFX_CMDHANDLERINFO@@@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "public: virtual int __thiscall CCmdTarget::IsInvokeAllowed(long)" (?IsInvokeAllowed@CCmdTarget@@UAEHJ@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "public: virtual int __thiscall CCmdTarget::GetDispatchIID(struct _GUID *)" (?GetDispatchIID@CCmdTarget@@UAEHPAU_GUID@@@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "public: virtual unsigned int __thiscall CCmdTarget::GetTypeInfoCount(void)" (?GetTypeInfoCount@CCmdTarget@@UAEIXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "public: virtual class CTypeLibCache * __thiscall CCmdTarget::GetTypeLibCache(void)" (?GetTypeLibCache@CCmdTarget@@UAEPAVCTypeLibCache@@XZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "public: virtual long __thiscall CCmdTarget::GetTypeLib(unsigned long,struct ITypeLib * *)" (?GetTypeLib@CCmdTarget@@UAEJKPAPAUITypeLib@@@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "protected: virtual struct AFX_DISPMAP const * __thiscall CCmdTarget::GetDispatchMap(void)const " (?GetDispatchMap@CCmdTarget@@MBEPBUAFX_DISPMAP@@XZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "protected: virtual struct AFX_EVENTSINKMAP const * __thiscall CCmdTarget::GetEventSinkMap(void)const " (?GetEventSinkMap@CCmdTarget@@MBEPBUAFX_EVENTSINKMAP@@XZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "protected: virtual struct AFX_INTERFACEMAP const * __thiscall CCmdTarget::GetInterfaceMap(void)const " (?GetInterfaceMap@CCmdTarget@@MBEPBUAFX_INTERFACEMAP@@XZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "public: virtual void __thiscall CCmdTarget::OnFinalRelease(void)" (?OnFinalRelease@CCmdTarget@@UAEXXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "public: virtual int __thiscall CCmdTarget::OnCreateAggregates(void)" (?OnCreateAggregates@CCmdTarget@@UAEHXZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "public: virtual struct IUnknown * __thiscall CCmdTarget::GetInterfaceHook(void const *)" (?GetInterfaceHook@CCmdTarget@@UAEPAUIUnknown@@PBX@Z) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
1>nafxcwd.lib(cmdtarg.obj) : error LNK2005: "protected: virtual struct AFX_CONNECTIONMAP const * __thiscall CCmdTarget::GetConnectionMap(void)const " (?GetConnectionMap@CCmdTarget@@MBEPBUAFX_CONNECTIONMAP@@XZ) 已经在 mfc90ud.lib(mfc90ud.dll) 中定义
goodname 2009-06-09
  • 打赏
  • 举报
回复
属性->通用属性->链接器->常规->附加库目录
这里可以设置你的obj,lib等所在的目录
属性->通用属性->链接器->输入->附加依赖项
这里才是obj,lib等文件的名字
jinling4388 2009-06-09
  • 打赏
  • 举报
回复
回复15#:

是在 属性->通用属性->链接器->常规->附加库目录:添加obj文件完整路径 吗?
我这样做了,还是不行。

我是在DLL中调用的,是不是要用其他方法呀?使用包含头文件的方式不行。都是连接错误。


大家再帮帮我吧!急死了,多谢!
ysysbaobei 2009-06-09
  • 打赏
  • 举报
回复
顶下
goodname 2009-06-09
  • 打赏
  • 举报
回复
在附加依赖项上加上obj的文件名就行。就像使用其他lib一样。

不过最好是同一版本编译器编译出来的,当然最好还是使用源文件.
jinling4388 2009-06-09
  • 打赏
  • 举报
回复
多谢各位了,我试试
crst_zh 2009-06-05
  • 打赏
  • 举报
回复
函数只有声明没有实现,i'm sure.
blh 2009-06-05
  • 打赏
  • 举报
回复
[Quote=引用楼主 jinling4388 的帖子:]
我的程序中有一个类,类的成员静态函数static BOOL Speech(CString szMes, DWORD dwParam)调用其他工程的静态函数了。然后编译链接没有任何问题。
但是,当我的程序中其他函数调Speech(…,…)时,却给我返回了“无法解析的外部符号”的链接错误。这是为什么呢?我的程序的编译选项是完全一样的,不是因为没包含库文件引起的。
[/Quote]

你的代码
jinling4388 2009-06-05
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 chenzhp 的回复:]
检查函数声明文件和定义文件参数是否一致
检查是否包含头文件
检测是否给出该函数的定义
如果是外部函数,是否包含了lib
[/Quote]

声明和定义在一起
后来调用接口的那个函数,既包含了自写函数所在的头文件,又包含了其他工程中原静态接口所在的头文件
检测是否给出该函数的定义? 静态函数,声明且都定义了
是外部函数,但是我不知道是哪个lib呀!

我写了个静态函数调其他工程的静态函数,这个没有问题。
问题出在我其他函数调本工程静态函数那里。
beackoom 2009-06-05
  • 打赏
  • 举报
回复
顶3楼
加载更多回复(10)

64,685

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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