can't compile dcmtk (link error LNK2005)

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
massimo
Posts: 4
Joined: Sat, 2005-03-05, 10:29

can't compile dcmtk (link error LNK2005)

#1 Post by massimo »

I tried almost everithing but i can't link dcmtk.
I'm using VS.NET 2003
I did the following steps:
- deleted all .vcproj and .sln files
- changed MT to MD and MTd to MDd options in CMakeLists (i need to use the toolkit in a MFC application)
- activated all external libraries support in CMake
- build dcmtk solution

if I don't change configuration flags to MD/MDd the solution can link correctly.

Otherwise I get the following errors
\\\\

Compiling...
cl : Command line warning D4002 : ignoring unknown option '-'
dcmgpdir.cxx
Linking...
LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in MSVCRTD.lib(MSVCR71D.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(getenv.obj) : error LNK2005: _getenv already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMTD.lib(tolower.obj) : error LNK2005: _tolower already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMTD.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in MSVCRTD.lib(crtexe.obj)
LIBCMTD.lib(crt0.obj) : error LNK2005: __amsg_exit already defined in MSVCRTD.lib(MSVCR71D.dll)
MSVCRTD.lib(MSVCR71D.dll) : error LNK2005: __access already defined in LIBCMTD.lib(access.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
Debug\dcmgpdir.exe : fatal error LNK1169: one or more multiply defined symbols found

these are solution settings:

LINKER COMMAND LINE

/OUT:"Debug\dcmdump.exe"
/INCREMENTAL:NO /NOLOGO
/LIBPATH:"E:\TESI\dcmtk-3.5.3\dcmdata\.\Debug"
/LIBPATH:"E:\TESI\dcmtk-3.5.3\dcmdata\\"
/LIBPATH:"E:\TESI\dcmtk-3.5.3\ofstd\.\Debug"
/LIBPATH:"E:\TESI\dcmtk-3.5.3\ofstd\\"
/LIBPATH:"E:\TESI\dcmtk-3.5.3\libs\zlib-1.2.1\lib\.\Debug"
/LIBPATH:"E:\TESI\dcmtk-3.5.3\libs\zlib-1.2.1\lib\\"
/LIBPATH:"E:\TESI\dcmtk-3.5.3\libs\libxml2-2.5.7\lib\.\Debug"
/LIBPATH:"E:\TESI\dcmtk-3.5.3\libs\libxml2-2.5.7\lib\\"
/LIBPATH:"E:\TESI\dcmtk-3.5.3\ofstd\libsrc\.\Debug"
/LIBPATH:"E:\TESI\dcmtk-3.5.3\ofstd\libsrc\\"
/LIBPATH:"E:\TESI\dcmtk-3.5.3\dcmdata\libsrc\.\Debug"
/LIBPATH:"E:\TESI\dcmtk-3.5.3\dcmdata\libsrc\\"
/DEBUG /PDB:"Debug\dcmdump.pdb"
/SUBSYSTEM:CONSOLE /STACK:10000000
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
uuid.lib odbc32.lib odbccp32.lib

C/C++ COMMAND LINE

/Od /I "E:\TESI\dcmtk-3.5.3\config\include"
/I "E:\TESI\dcmtk-3.5.3\dcmdata\include"
/I "E:\TESI\dcmtk-3.5.3\ofstd\include"
/I "E:\TESI\dcmtk-3.5.3\libs\zlib-1.2.1\include"
/I "E:\TESI\dcmtk-3.5.3\libs\libxml2-2.5.7\include"
/D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_REENTRANT" /D "WITH_LIBXML" /D "WITH_LIBPNG" /D "WITH_LIBTIFF"
/D "WITH_OPENSSL" /D "WITH_ZLIB" /D "_MBCS" /FD /EHsc /MDd /GS /GR /Fo"Debug\\"
/Fd"Debug/dcmdump.pdb" /W3 /nologo /c /Z7 /TP

Someone suggested that some parts may have been configured differently from the rest of the project,
but all the projects seem to be Multithreaded DLL.
Could the problem be the external liberaries?Should I have recompiled them?
can any one help me?I'm going slightly mad...please!

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

#2 Post by Thomas Wilkens »

Everything we know is already contained in this thread. If these suggestions dont work, you should feed Google with an appropriate question. This is not an error in DCMTK, but a compiler problem. Maybe you also want to try to find a forum concerning Visual Studio 2003.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest