Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help linking MFC with standard C++ library 1

Status
Not open for further replies.

titanandrews

Programmer
Feb 27, 2003
130
US
Hello All,
I am having a terrible time during the link step. Here is my scenario:
[ul]
[li]I have written a program that only uses classes from the standard C++ library. It is a console based app.[/li]
[li]Now I want to bolt on a GUI front end to this thing, so I used VS 7.0 to build a simple GUI. [/li]
[li]Both programs compile, link, and execute just fine. [/li]
[li]Now I bring in my classes from the console app into the VS project[/li]
[li]I created a makefile to build everything, but I get tons of linker errors. I have the output below[/li]
[li]Microsoft seems to be a little smarter in building this thing because it can build it just fine. However, when I run it, it kicks off the command window and crashes immediately due to a failed ASSERT. The ASSERT comes from appcore.cpp.[/li]
[/ul]
Code:
CWinApp::CWinApp(LPCTSTR lpszAppName)
{
if (lpszAppName != NULL)
		m_pszAppName = _tcsdup(lpszAppName);
	else
		m_pszAppName = NULL;

	// initialize CWinThread state
	AFX_MODULE_STATE* pModuleState = _AFX_CMDTARGET_GETSTATE();
	AFX_MODULE_THREAD_STATE* pThreadState = pModuleState->m_thread;
	ASSERT(AfxGetThread() == NULL);       //***** Fails here ***** AfxGetThread() is NOT NULL!!!!!!

... Continued


Here is the link errors I get when I use my makefile
Code:
        link /OUT:"Release/PackageVerify.exe" /INCREMENTAL:NO /NOLOGO /DEBUG /PDB:"Release/PackageVerify.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /O
PT:ICF /MACHINE:IX86 release\\MainFrm.obj           release\\Pack.obj              release\\PackDoc.obj           release\\PackView.obj
     release\\main.obj              release\\stdafx.obj            release\\Pack.res              release\\PackageVerify.obj     release\\EJ
BPackageVerify.obj  release\\ServletPackageVerify.obj
nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual void __thiscall CWinThread::Delete(void)" (?Delete@CWinThread@@UAEXXZ) already de
fined in mfc70.lib(MFC70.DLL)
nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::IsIdleMessage(struct tagMSG *)" (?IsIdleMessage@CWinTh
read@@UAEHPAUtagMSG@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::PreTranslateMessage(struct tagMSG *)" (?PreTranslateMe
ssage@CWinThread@@UAEHPAUtagMSG@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual class CWnd * __thiscall CWinThread::GetMainWnd(void)" (?GetMainWnd@CWinThread@@UA
EPAVCWnd@@XZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::ProcessMessageFilter(int,struct tagMSG *)" (?ProcessMe
ssageFilter@CWinThread@@UAEHHPAUtagMSG@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(thrdcore.obj) : error LNK2005: "public: virtual int __thiscall CWinThread::PumpMessage(void)" (?PumpMessage@CWinThread@@UAEHXZ) a
lready defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(winstr.obj) : error LNK2005: "struct HINSTANCE__ * __stdcall AfxFindStringResourceHandle(unsigned int)" (?AfxFindStringResourceHa
ndle@@YGPAUHINSTANCE__@@I@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual void __thiscall CWnd::PreSubclassWindow(void)" (?PreSubclassWindow@CWnd@@UAEXXZ) a
lready defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual void __thiscall CWnd::PostNcDestroy(void)" (?PostNcDestroy@CWnd@@MAEXXZ) alread
y defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual void __thiscall CWnd::OnFinalRelease(void)" (?OnFinalRelease@CWnd@@UAEXXZ) already
 defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual long __thiscall CWnd::DefWindowProcA(unsigned int,unsigned int,long)" (?DefWind
owProcA@CWnd@@MAEJIIJ@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual long (__stdcall** __thiscall CWnd::GetSuperWndProcAddr(void))(struct HWND__ *,u
nsigned int,unsigned int,long)" (?GetSuperWndProcAddr@CWnd@@MAEPAP6GJPAUHWND__@@IIJ@ZXZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CWnd::PreTranslateMessage(struct tagMSG *)" (?PreTranslateMessage@C
Wnd@@UAEHPAUtagMSG@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CWnd::OnToolHitTest(class CPoint,struct tagTOOLINFOA *)const " (?On
ToolHitTest@CWnd@@UBEHVCPoint@@PAUtagTOOLINFOA@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual struct AFX_MSGMAP const * __thiscall CWnd::GetMessageMap(void)const " (?GetMess
ageMap@CWnd@@MBEPBUAFX_MSGMAP@@XZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual long __thiscall CWnd::WindowProc(unsigned int,unsigned int,long)" (?WindowProc@
CWnd@@MAEJIIJ@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual class CScrollBar * __thiscall CWnd::GetScrollBarCtrl(int)const " (?GetScrollBarCtr
l@CWnd@@UBEPAVCScrollBar@@H@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual void __thiscall CWnd::CalcWindowRect(struct tagRECT *,unsigned int)" (?CalcWindowR
ect@CWnd@@UAEXPAUtagRECT@@I@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual struct AFX_INTERFACEMAP const * __thiscall CWnd::GetInterfaceMap(void)const " (
?GetInterfaceMap@CWnd@@MBEPBUAFX_INTERFACEMAP@@XZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::EnsureStdObj(void)" (?EnsureStdObj@CWnd@@UAEJXZ) already def
ined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::get_accParent(struct IDispatch * *)" (?get_accParent@CWnd@@U
AEJPAPAUIDispatch@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::get_accChildCount(long *)" (?get_accChildCount@CWnd@@UAEJPAJ
@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::get_accChild(struct tagVARIANT,struct IDispatch * *)" (?get_
accChild@CWnd@@UAEJUtagVARIANT@@PAPAUIDispatch@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::get_accName(struct tagVARIANT,wchar_t * *)" (?get_accName@CW
nd@@UAEJUtagVARIANT@@PAPA_W@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::get_accValue(struct tagVARIANT,wchar_t * *)" (?get_accValue@
CWnd@@UAEJUtagVARIANT@@PAPA_W@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::get_accDescription(struct tagVARIANT,wchar_t * *)" (?get_acc
Description@CWnd@@UAEJUtagVARIANT@@PAPA_W@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::get_accRole(struct tagVARIANT,struct tagVARIANT *)" (?get_ac
cRole@CWnd@@UAEJUtagVARIANT@@PAU2@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::get_accState(struct tagVARIANT,struct tagVARIANT *)" (?get_a
ccState@CWnd@@UAEJUtagVARIANT@@PAU2@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::get_accHelp(struct tagVARIANT,wchar_t * *)" (?get_accHelp@CW
nd@@UAEJUtagVARIANT@@PAPA_W@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::get_accHelpTopic(wchar_t * *,struct tagVARIANT,long *)" (?ge
t_accHelpTopic@CWnd@@UAEJPAPA_WUtagVARIANT@@PAJ@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::get_accKeyboardShortcut(struct tagVARIANT,wchar_t * *)" (?ge
t_accKeyboardShortcut@CWnd@@UAEJUtagVARIANT@@PAPA_W@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::get_accFocus(struct tagVARIANT *)" (?get_accFocus@CWnd@@UAEJ
PAUtagVARIANT@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::get_accSelection(struct tagVARIANT *)" (?get_accSelection@CW
nd@@UAEJPAUtagVARIANT@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::get_accDefaultAction(struct tagVARIANT,wchar_t * *)" (?get_a
ccDefaultAction@CWnd@@UAEJUtagVARIANT@@PAPA_W@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::accSelect(long,struct tagVARIANT)" (?accSelect@CWnd@@UAEJJUt
agVARIANT@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::accLocation(long *,long *,long *,long *,struct tagVARIANT)"
(?accLocation@CWnd@@UAEJPAJ000UtagVARIANT@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::accNavigate(long,struct tagVARIANT,struct tagVARIANT *)" (?a
ccNavigate@CWnd@@UAEJJUtagVARIANT@@PAU2@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::accHitTest(long,long,struct tagVARIANT *)" (?accHitTest@CWnd
@@UAEJJJPAUtagVARIANT@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::accDoDefaultAction(struct tagVARIANT)" (?accDoDefaultAction@
CWnd@@UAEJUtagVARIANT@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::put_accName(struct tagVARIANT,wchar_t *)" (?put_accName@CWnd
@@UAEJUtagVARIANT@@PA_W@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::put_accValue(struct tagVARIANT,wchar_t *)" (?put_accValue@CW
nd@@UAEJUtagVARIANT@@PA_W@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual long __thiscall CWnd::SetProxy(struct IAccessibleProxy *)" (?SetProxy@CWnd@@UAEJPA
UIAccessibleProxy@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CWnd::CheckAutoCenter(void)" (?CheckAutoCenter@CWnd@@UAEHXZ) alread
y defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CWnd::ContinueModal(void)" (?ContinueModal@CWnd@@UAEHXZ) already de
fined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual int __thiscall CWnd::SetOccDialogInfo(struct _AFX_OCC_DIALOG_INFO *)" (?SetOccD
ialogInfo@CWnd@@MAEHPAU_AFX_OCC_DIALOG_INFO@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CWnd::IsFrameWnd(void)const " (?IsFrameWnd@CWnd@@UBEHXZ) already de
fined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CFrameWnd::IsFrameWnd(void)const " (?IsFrameWnd@CFrameWnd@@UBEHXZ)
already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual int __thiscall CWnd::CreateControlContainer(class COleControlContainer * *)" (?
CreateControlContainer@CWnd@@MAEHPAPAVCOleControlContainer@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual int __thiscall CWnd::CreateControlSite(class COleControlContainer *,class COleC
ontrolSite * *,unsigned int,struct _GUID const &)" (?CreateControlSite@CWnd@@MAEHPAVCOleControlContainer@@PAPAVCOleControlSite@@IABU_GUID@@@
Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: __thiscall CWnd::CWnd(void)" (??0CWnd@@QAE@XZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CWnd::CreateEx(unsigned long,char const *,char const *,unsigned lon
g,struct tagRECT const &,class CWnd *,unsigned int,void *)" (?CreateEx@CWnd@@UAEHKPBD0KABUtagRECT@@PAV1@IPAX@Z) already defined in mfc70.lib
(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CWnd::Create(char const *,char const *,unsigned long,struct tagRECT
 const &,class CWnd *,unsigned int,struct CCreateContext *)" (?Create@CWnd@@UAEHPBD0KABUtagRECT@@PAV1@IPAUCCreateContext@@@Z) already define
d in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual void __thiscall CWnd::WinHelpInternal(unsigned long,unsigned int)" (?WinHelpIntern
al@CWnd@@UAEXKI@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: int __thiscall CWnd::MessageBoxA(char const *,char const *,unsigned int)" (?MessageBoxA@CW
nd@@QAEHPBD0I@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: long __thiscall CWnd::GetAccessibilityLocation(struct tagVARIANT,long *,long *,long *,long
 *)" (?GetAccessibilityLocation@CWnd@@QAEJUtagVARIANT@@PAJ111@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual void __thiscall CWnd::EndModalLoop(int)" (?EndModalLoop@CWnd@@UAEXH@Z) already def
ined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CWnd::PreCreateWindow(struct tagCREATESTRUCTA &)" (?PreCreateWindow
@CWnd@@UAEHAAUtagCREATESTRUCTA@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CWnd::DestroyWindow(void)" (?DestroyWindow@CWnd@@UAEHXZ) already de
fined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: class CFrameWnd * __thiscall CWnd::GetParentFrame(void)const " (?GetParentFrame@CWnd@@QBEP
AVCFrameWnd@@XZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: long __thiscall CWnd::GetAccessibleChildCount(void)" (?GetAccessibleChildCount@CWnd@@QAEJX
Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: long __thiscall CWnd::GetAccessibleChild(struct tagVARIANT,struct IDispatch * *)" (?GetAcc
essibleChild@CWnd@@QAEJUtagVARIANT@@PAPAUIDispatch@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: long __thiscall CWnd::GetAccessibilityHitTest(long,long,struct tagVARIANT *)" (?GetAccessi
bilityHitTest@CWnd@@QAEJJJPAUtagVARIANT@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: &quot;public: void __thiscall CWnd::GetWindowTextA(class ATL::CStringT<char,class StrTraitMFC<char,class
 ATL::ChTraitsCRT<char> > > &)const &quot; (?GetWindowTextA@CWnd@@QBEXAAV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z) already de
fined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: &quot;protected: virtual int __thiscall CWnd::OnCommand(unsigned int,long)&quot; (?OnCommand@CWnd@@MAEHIJ@Z)
already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: &quot;protected: virtual int __thiscall CWnd::OnNotify(unsigned int,long,long *)&quot; (?OnNotify@CWnd@@MAEHI
JPAJ@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: &quot;public: long __thiscall CWnd::GetAccessibleName(struct tagVARIANT,wchar_t * *)&quot; (?GetAccessibleNam
e@CWnd@@QAEJUtagVARIANT@@PAPA_W@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: &quot;public: virtual int __thiscall CWnd::CreateEx(unsigned long,char const *,char const *,unsigned lon
g,int,int,int,int,struct HWND__ *,struct HMENU__ *,void *)&quot; (?CreateEx@CWnd@@UAEHKPBD0KHHHHPAUHWND__@@PAUHMENU__@@PAX@Z) already defined in
mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: &quot;protected: virtual int __thiscall CWnd::OnWndMsg(unsigned int,unsigned int,long,long *)&quot; (?OnWndMs
g@CWnd@@MAEHIIJPAJ@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: &quot;public: virtual long __thiscall CWnd::CreateAccessibleProxy(unsigned int,long,long *)&quot; (?CreateAcc
essibleProxy@CWnd@@UAEJIJPAJ@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: &quot;public: virtual void __thiscall CWnd::WinHelpA(unsigned long,unsigned int)&quot; (?WinHelpA@CWnd@@UAEXK
I@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: &quot;public: virtual void __thiscall CWnd::HtmlHelpA(unsigned long,unsigned int)&quot; (?HtmlHelpA@CWnd@@UAE
XKI@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: &quot;protected: virtual int __thiscall CWnd::OnChildNotify(unsigned int,unsigned int,long,long *)&quot; (?On
ChildNotify@CWnd@@MAEHIIJPAJ@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;public: virtual int __thiscall CCmdTarget::OnCmdMsg(unsigned int,int,void *,struct AFX_CMDHANDLERI
NFO *)&quot; (?OnCmdMsg@CCmdTarget@@UAEHIHPAXPAUAFX_CMDHANDLERINFO@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;public: virtual int __thiscall CCmdTarget::IsInvokeAllowed(long)&quot; (?IsInvokeAllowed@CCmdTarget@@UA
EHJ@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;public: virtual int __thiscall CCmdTarget::GetDispatchIID(struct _GUID *)&quot; (?GetDispatchIID@CCmdTa
rget@@UAEHPAU_GUID@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;public: virtual unsigned int __thiscall CCmdTarget::GetTypeInfoCount(void)&quot; (?GetTypeInfoCount@CCm
dTarget@@UAEIXZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;public: virtual class CTypeLibCache * __thiscall CCmdTarget::GetTypeLibCache(void)&quot; (?GetTypeLibCa
che@CCmdTarget@@UAEPAVCTypeLibCache@@XZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;public: virtual long __thiscall CCmdTarget::GetTypeLib(unsigned long,struct ITypeLib * *)&quot; (?GetTy
peLib@CCmdTarget@@UAEJKPAPAUITypeLib@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;protected: virtual struct AFX_DISPMAP const * __thiscall CCmdTarget::GetDispatchMap(void)const &quot; (
?GetDispatchMap@CCmdTarget@@MBEPBUAFX_DISPMAP@@XZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;protected: virtual struct AFX_EVENTSINKMAP const * __thiscall CCmdTarget::GetEventSinkMap(void)con
st &quot; (?GetEventSinkMap@CCmdTarget@@MBEPBUAFX_EVENTSINKMAP@@XZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;protected: virtual struct AFX_INTERFACEMAP const * __thiscall CCmdTarget::GetInterfaceMap(void)con
st &quot; (?GetInterfaceMap@CCmdTarget@@MBEPBUAFX_INTERFACEMAP@@XZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;public: virtual void __thiscall CCmdTarget::OnFinalRelease(void)&quot; (?OnFinalRelease@CCmdTarget@@UAE
XXZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;public: virtual int __thiscall CCmdTarget::OnCreateAggregates(void)&quot; (?OnCreateAggregates@CCmdTarg
et@@UAEHXZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;public: virtual struct IUnknown * __thiscall CCmdTarget::GetInterfaceHook(void const *)&quot; (?GetInte
rfaceHook@CCmdTarget@@UAEPAUIUnknown@@PBX@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;protected: virtual struct AFX_CONNECTIONMAP const * __thiscall CCmdTarget::GetConnectionMap(void)c
onst &quot; (?GetConnectionMap@CCmdTarget@@MBEPBUAFX_CONNECTIONMAP@@XZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;protected: virtual struct IConnectionPoint * __thiscall CCmdTarget::GetConnectionHook(struct _GUID
 const &)&quot; (?GetConnectionHook@CCmdTarget@@MAEPAUIConnectionPoint@@ABU_GUID@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;protected: virtual int __thiscall CCmdTarget::GetExtraConnectionPoints(class CPtrArray *)&quot; (?GetEx
traConnectionPoints@CCmdTarget@@MAEHPAVCPtrArray@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(cmdtarg.obj) : error LNK2005: &quot;protected: virtual struct AFX_OLECMDMAP const * __thiscall CCmdTarget::GetCommandMap(void)const &quot;
(?GetCommandMap@CCmdTarget@@MBEPBUAFX_OLECMDMAP@@XZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(except.obj) : error LNK2005: &quot;void __stdcall AfxThrowMemoryException(void)&quot; (?AfxThrowMemoryException@@YGXXZ) already defined in
mfc70.lib(MFC70.DLL)
nafxcw.lib(winocc.obj) : error LNK2005: &quot;public: virtual int __thiscall CWnd::OnAmbientProperty(class COleControlSite *,long,struct tagVARIA
NT *)&quot; (?OnAmbientProperty@CWnd@@UAEHPAVCOleControlSite@@JPAUtagVARIANT@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(winocc.obj) : error LNK2005: &quot;public: int __thiscall CWnd::ShowWindow(int)&quot; (?ShowWindow@CWnd@@QAEHH@Z) already defined in mfc70.
lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: virtual int __thiscall CWinApp::LoadSysPolicies(void)&quot; (?LoadSysPolicies@CWinApp@@UAEHXZ)
already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: virtual int __thiscall CWinApp::InitApplication(void)&quot; (?InitApplication@CWinApp@@UAEHXZ)
already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: virtual struct HINSTANCE__ * __thiscall CWinApp::LoadAppLangResourceDLL(void)&quot; (?LoadAppLa
ngResourceDLL@CWinApp@@UAEPAUHINSTANCE__@@XZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;protected: void __thiscall CWinApp::LoadStdProfileSettings(unsigned int)&quot; (?LoadStdProfileSettings
@CWinApp@@IAEXI@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: void __thiscall CWinApp::ParseCommandLine(class CCommandLineInfo &)&quot; (?ParseCommandLine@CW
inApp@@QAEXAAVCCommandLineInfo@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: virtual __thiscall CWinApp::~CWinApp(void)&quot; (??1CWinApp@@UAE@XZ) already defined in mfc70.
lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: virtual int __thiscall CWinApp::ExitInstance(void)&quot; (?ExitInstance@CWinApp@@UAEHXZ) alread
y defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: virtual long __thiscall CWinApp::ProcessWndProcException(class CException *,struct tagMSG
const *)&quot; (?ProcessWndProcException@CWinApp@@UAEJPAVCException@@PBUtagMSG@@@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: virtual int __thiscall CWinApp::OnIdle(long)&quot; (?OnIdle@CWinApp@@UAEHJ@Z) already defined i
n mfc70.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: virtual struct CRuntimeClass * __thiscall CWinApp::GetRuntimeClass(void)const &quot; (?GetRunti
meClass@CWinApp@@UBEPAUCRuntimeClass@@XZ) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: virtual int __thiscall CWinApp::InitInstance(void)&quot; (?InitInstance@CWinApp@@UAEHXZ) alread
y defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: virtual int __thiscall CWinApp::Run(void)&quot; (?Run@CWinApp@@UAEHXZ) already defined in mfc70
.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: virtual void __thiscall CWinApp::WinHelpA(unsigned long,unsigned int)&quot; (?WinHelpA@CWinApp@
@UAEXKI@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: virtual void __thiscall CWinApp::HtmlHelpA(unsigned long,unsigned int)&quot; (?HtmlHelpA@CWinAp
p@@UAEXKI@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: virtual void __thiscall CWinApp::WinHelpInternal(unsigned long,unsigned int)&quot; (?WinHelpInt
ernal@CWinApp@@UAEXKI@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: __thiscall CWinApp::CWinApp(char const *)&quot; (??0CWinApp@@QAE@PBD@Z) already defined in mfc7
0.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: __thiscall CCommandLineInfo::CCommandLineInfo(void)&quot; (??0CCommandLineInfo@@QAE@XZ) already
 defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appcore.obj) : error LNK2005: &quot;public: virtual __thiscall CCommandLineInfo::~CCommandLineInfo(void)&quot; (??1CCommandLineInfo@@UAE@XZ
) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appui1.obj) : error LNK2005: &quot;public: virtual int __thiscall CWinApp::DoMessageBox(char const *,unsigned int,unsigned int)&quot; (?DoM
essageBox@CWinApp@@UAEHPBDII@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appui1.obj) : error LNK2005: &quot;int __stdcall AfxMessageBox(unsigned int,unsigned int,unsigned int)&quot; (?AfxMessageBox@@YGHIII@Z) alr
eady defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appui.obj) : error LNK2005: &quot;public: virtual void __thiscall CWinApp::DoWaitCursor(int)&quot; (?DoWaitCursor@CWinApp@@UAEXH@Z) already
 defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appui.obj) : error LNK2005: &quot;public: virtual int __thiscall CWinApp::SaveAllModified(void)&quot; (?SaveAllModified@CWinApp@@UAEHXZ) al
ready defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appui.obj) : error LNK2005: &quot;public: virtual void __thiscall CWinApp::AddToRecentFileList(char const *)&quot; (?AddToRecentFileList@CW
inApp@@UAEXPBD@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appui.obj) : error LNK2005: &quot;public: virtual class CDocument * __thiscall CWinApp::OpenDocumentFile(char const *)&quot; (?OpenDocument
File@CWinApp@@UAEPAVCDocument@@PBD@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appui.obj) : error LNK2005: &quot;public: virtual int __thiscall CWinApp::OnDDECommand(char *)&quot; (?OnDDECommand@CWinApp@@UAEHPAD@Z) alr
eady defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(appui3.obj) : error LNK2005: &quot;protected: void __thiscall CWinApp::SetRegistryKey(char const *)&quot; (?SetRegistryKey@CWinApp@@IAEXPBD
@Z) already defined in mfc70.lib(MFC70.DLL)
nafxcw.lib(filest.obj) : error LNK2005: &quot;public: static int __stdcall CFile::GetStatus(char const *,struct CFileStatus &)&quot; (?GetStatus@CFile
@@SGHPBDAAUCFileStatus@@@Z) already defined in mfc70.lib(MFC70.DLL)
libc.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrt.lib(MSVCR70.dll)
libc.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrt.lib(MSVCR70.dll)
libc.lib(crt0dat.obj) : error LNK2005: __cexit already defined in msvcrt.lib(MSVCR70.dll)
libc.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in msvcrt.lib(MSVCR70.dll)
libc.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrt.lib(cinitexe.obj)
libc.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrt.lib(cinitexe.obj)
libc.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrt.lib(cinitexe.obj)
libc.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrt.lib(cinitexe.obj)
libc.lib(fflush.obj) : error LNK2005: _fflush already defined in msvcrt.lib(MSVCR70.dll)
libc.lib(crt0.obj) : error LNK2005: __amsg_exit already defined in msvcrt.lib(MSVCR70.dll)
libcp.lib(ios.obj) : error LNK2005: &quot;public: void __thiscall std::ios_base::_Addstd(void)&quot; (?_Addstd@ios_base@std@@QAEXXZ) already defined i
n msvcprt.lib(MSVCP70.dll)
libcp.lib(ios.obj) : error LNK2005: &quot;public: virtual __thiscall std::ios_base::~ios_base(void)&quot; (??1ios_base@std@@UAE@XZ) already defined in
 msvcprt.lib(MSVCP70.dll)
libcp.lib(ios.obj) : error LNK2005: &quot;public: void __thiscall std::ios_base::clear(int,bool)&quot; (?clear@ios_base@std@@QAEXH_N@Z) already define
d in msvcprt.lib(MSVCP70.dll)
libcp.lib(ios.obj) : error LNK2005: &quot;protected: void __thiscall std::ios_base::_Init(void)&quot; (?_Init@ios_base@std@@IAEXXZ) already defined in
 msvcprt.lib(MSVCP70.dll)
libcp.lib(locale0.obj) : error LNK2005: &quot;public: class std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned int)const &quot; (?_
Getfacet@locale@std@@QBEPBVfacet@12@I@Z) already defined in msvcprt.lib(MSVCP70.dll)
libcp.lib(locale0.obj) : error LNK2005: &quot;public: void __thiscall std::locale::facet::_Register(void)&quot; (?_Register@facet@locale@std@@QAEXXZ)
already defined in msvcprt.lib(MSVCP70.dll)
libcp.lib(locale0.obj) : error LNK2005: &quot;public: __thiscall std::_Locinfo::~_Locinfo(void)&quot; (??1_Locinfo@std@@QAE@XZ) already defined in msv
cprt.lib(MSVCP70.dll)
libcp.lib(locale0.obj) : error LNK2005: &quot;public: __thiscall std::_Locinfo::_Locinfo(char const *)&quot; (??0_Locinfo@std@@QAE@PBD@Z) already defi
ned in msvcprt.lib(MSVCP70.dll)
libcp.lib(locale0.obj) : error LNK2005: &quot;public: __thiscall std::locale::locale(void)&quot; (??0locale@std@@QAE@XZ) already defined in msvcprt.li
b(MSVCP70.dll)
libcp.lib(locale.obj) : error LNK2005: &quot;private: void __thiscall std::locale::_Locimp::_Addfac(class std::locale::facet *,unsigned int)&quot; (?_
Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z) already defined in msvcprt.lib(MSVCP70.dll)
libcp.lib(locale.obj) : error LNK2005: &quot;private: __thiscall std::locale::_Locimp::_Locimp(class std::locale::_Locimp const &)&quot; (??0_Locimp@l
ocale@std@@AAE@ABV012@@Z) already defined in msvcprt.lib(MSVCP70.dll)
libcp.lib(xwctomb.obj) : error LNK2005: __Getcvt already defined in msvcprt.lib(MSVCP70.dll)
LINK : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'nafxcw.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'libc.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
Release/PackageVerify.exe : fatal error LNK1169: one or more multiply defined symbols found
NMAKE : fatal error U1077: 'link' : return code '0x491'
Stop.

If I remove the 3 .objs (the console part) from the link step, then of course it's okay. But even if I ad just one back to the list of objs to link, it fails with this same error.

I know that the linker is giving me some clues about why the problem is happening &quot;defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library&quot;, but I just can't quite piece it all together to make sense. Can someone please help me out?



many many thanks,


Barry
 
>> I created a makefile to build everything
>> Here is the link errors I get when I use my makefile

Why are you using a make file? Why not just add your classes to the project and build it from the IDE?

-pete
 
Pete,
Yes I did that too. VS knows how to build it, but apparently not correctly because like I said when I run it, it kicks off a command window then crashes. The 2 programs run fine when built and run separately. It's when I try to build them all together into 1 exe that I get problems. I know it's something I'm doing wrong, but what?

The makefile is just an educational experience.

There is way to much code to post here, but maybe I can conjure up a test case to post. Actually trying to figure out a test case may help me solve the problem. :)

If you have any ideas, please let me know...


regards,


Barry
 
>> when I run it, it kicks off a command window then crashes.

Barry, obviously you need to find out exactly what is causing the crash. Assuming that the build configuration is incorrect and therefore the cause of the crash is just not a good problem solving approach.

Are you executing it in debug mode? If so that should help you pinpoint the problem in seconds. If not you should be.



-pete
 
Yes, I am running in Debug mode and I do see where it crashes. As I stated above it happens on an ASSERT statement in appcore.cpp which is not my code. &quot;ASSERT(AfxGetThread() == NULL);&quot; The answer is not obvious (to me anyway) which is why I posted this message. I find it bizarre that it starts this command window. It is supposed to be a GUI application.


Barry
 
When that ASSERT stops the debugger, use the stack window to find the entry point from your code into that call. When you double click on the line in the stack window open the file and position the cursor on that line of code.

-pete
 
HEY!!! I finally figured it out! For some strange reason when I added my source files to the already existing project I lost the link option /SUBSYSTEM:WINDOWS So that explains why it was kicking off the command window, and then it would crash when my constructor called CWinApp. Makes sense now![smarty] Thanks for your help Pete!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top