Dcmtk compilation

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
kattabomane
Posts: 43
Joined: Tue, 2005-02-01, 22:53

Dcmtk compilation

#1 Post by kattabomane »

Hello,
I have compiled successfully the dcmtk libraries into VS6 c++.
Now i have just made a test MFC project and i have just declared a variable :

Code: Select all

DcmFileFormat fileformat;
I have added the good libraries into the linker options. I followed each step as indicated in the FAQ for solving errors LNK2001...
Finally i got blocked with these unresolvable errors.
I tryed out many things but it didn't work.
Here are the errors :
Linking...
libcpmtd.lib(locale0.obj) : error LNK2005: "public: class std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned int,bool)const " (?_Getfacet@locale@std@@QBEPBVfacet@12@I_N@Z) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale0.obj) : error LNK2005: "public: bool __thiscall std::locale::_Iscloc(void)const " (?_Iscloc@locale@std@@QBE_NXZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(void)" (?_Init@locale@std@@CAPAV_Locimp@12@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(ios.obj) : error LNK2005: "public: void __thiscall std::ios_base::clear(int,bool)" (?clear@ios_base@std@@QAEXH_N@Z) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(ios.obj) : error LNK2005: "public: virtual __thiscall std::ios_base::~ios_base(void)" (??1ios_base@std@@UAE@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(ios.obj) : error LNK2005: "protected: void __thiscall std::ios_base::_Addstd(void)" (?_Addstd@ios_base@std@@IAEXXZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(ios.obj) : error LNK2005: "protected: void __thiscall std::ios_base::_Init(void)" (?_Init@ios_base@std@@IAEXXZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(iostream.obj) : error LNK2005: "public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(iostream.obj) : error LNK2005: "public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale.obj) : error LNK2005: "public: __thiscall std::_Locinfo::_Locinfo(char const *)" (??0_Locinfo@std@@QAE@PBD@Z) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale.obj) : error LNK2005: "public: __thiscall std::_Locinfo::~_Locinfo(void)" (??1_Locinfo@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno 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(lconv.obj) : error LNK2005: _localeconv already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCMTD.lib(getenv.obj) : error LNK2005: _getenv already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in msvcrtd.lib(MSVCRTD.dll)
msvcrtd.lib(MSVCRTD.dll) : error LNK2005: __setmbcp already defined in LIBCMTD.lib(mbctype.obj)
LINK : warning LNK4098: defaultlib "msvcrtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library
LIBCMTD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Test.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Test.exe - 26 error(s), 2 warning(s)
Has someone an idea about ?
Help please ?

Thanks.

Thomas Wilkens
DCMTK Developer
Posts: 117
Joined: Tue, 2004-11-02, 17:21
Location: Oldenburg, Germany
Contact:

#2 Post by Thomas Wilkens »

See viewtopic.php?t=111. My last hint regarding the runtime library settings should solve your problem.

kattabomane
Posts: 43
Joined: Tue, 2005-02-01, 22:53

Error link

#3 Post by kattabomane »

Hello,
I red the post, and i have the same option for dcmtk and my mfc application. The both have Debug Multithreaded for run time library.
I got the same errors as specified in my last post.
Any help is appreciated.

Dcmtk config :
/nologo /MTd /W3 /GX /Z7 /Od /I "../../config\include" /I "../../dcmdata\include" /I "../../ofstd\include" /I "../../../zlib-1.2.1\include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_REENTRANT" /D "WITH_LIBPNG" /D "WITH_LIBTIFF" /D "WITH_ZLIB" /D "dcmdata_EXPORTS" /D CMAKE_INTDIR=\"Debug\" /Fp"Debug/dcmdata.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
Test application config :
/nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"Debug/Test.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
I am using VS6 C++.
Thanks.

Thomas Wilkens
DCMTK Developer
Posts: 117
Joined: Tue, 2004-11-02, 17:21
Location: Oldenburg, Germany
Contact:

#4 Post by Thomas Wilkens »

One possibility could be to ignore some of the standard libraries that are mentioned in the linker's __warning__ messages. In order to do so, enter e.g. "msvcrtd.lib" or "LIBCMTD.lib" or "msvcrtd.lib, LIBCMTD.lib" (without the quotation marks) into your main project's project settings -> Linker -> Input -> ignore libraries entry field.

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#5 Post by Marco Eichelberg »

The problem could also be related to the problem discussed in this thread. Did you check that?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest