[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Converting from MFC in Static Library to Shared DLL

Posted on 1998-08-18
4
Medium Priority
?
2,450 Views
Last Modified: 2013-11-20
I am using Visual C++ 5.0 and I am working on a project
which currently links to MFC as a Static Library.  I need
to convert this project so that it links to MFC as a Shared
DLL.  I changed the project setting to "Use MFC in a Shared
DLL."  However, now I get many link errors.  Here are
the some of the errors:

Linking...
LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _calloc already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _realloc already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrtd.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrtd.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrtd.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrtd.lib(cinitexe.obj)
LIBCMTD.lib(strftime.obj) : error LNK2005: _strftime already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCMTD.lib(atox.obj) : error LNK2005: _atoi already defined in msvcrtd.lib(MSVCRTD.dll)
libcimtd.lib(ostream.obj) : error LNK2005: "public: class ostream & __thiscall ostream::operator<<(char const *)" (??6ostream@@QAEAAV0@PBD@Z) already defined in msvcirtd.lib(MSVCIRTD.dll)
nafxcwd.lib(afxmem.obj) : error LNK2005: "public: static void * __stdcall CObject::operator new(unsigned int)" (??2CObject@@SGPAXI@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcwd.lib(afxmem.obj) : error LNK2005: "public: static void __stdcall CObject::operator delete(void *)" (??3CObject@@SGXPAX@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int,char const *,int)" (??2@YAPAXIPBDH@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcwd.lib(afxmem.obj) : error LNK2005: "public: static void * __stdcall CObject::operator new(unsigned int,char const *,int)" (??2CObject@@SGPAXIPBDH@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcwd.lib(objcore.obj) : error LNK2005: "public: int __thiscall CObject::IsKindOf(struct CRuntimeClass const *)const " (?IsKindOf@CObject@@QBEHPBUCRuntimeClass@@@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcwd.lib(afxinl1.obj) : error LNK2005: "public: virtual void __thiscall CObject::Serialize(class CArchive &)" (?Serialize@CObject@@UAEXAAVCArchive@@@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcwd.lib(afxinl1.obj) : error LNK2005: "public: int __thiscall CString::GetLength(void)const " (?GetLength@CString@@QBEHXZ) already defined in mfc42d.lib(MFC42D.DLL)
nafxcwd.lib(afxinl1.obj) : error LNK2005: "public: __thiscall CString::operator char const *(void)const " (??BCString@@QBEPBDXZ) already defined in mfc42d.lib(MFC42D.DLL)

What is the problem?
0
Comment
Question by:kaplan1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 1320966
In the Project Settings/Link menu remove any Object/library module specifications that you have included.
0
 

Author Comment

by:kaplan1
ID: 1320967
I removed the one library (Winmm.lib) listed in the Project Settings/Link menu's
Object/library module specifications, and it did not make any difference.
0
 
LVL 8

Accepted Solution

by:
trestan earned 800 total points
ID: 1320968
You have to remove the libs you used one by one to see which one cause the problem. The error is occurred because one function may be defined in more than one libs. Also please take a look at the article:
http://support.microsoft.com/support/kb/articles/q148/6/52.asp
0
 
LVL 8

Expert Comment

by:trestan
ID: 1320969
In your project setting's input catagory:
Add LIBCMTD.lib msvcrtd.lib to both object/library modules and the next ignore libraries edit boxes and recompile your project to see what happened. Good luck.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question