linking dcmtk to existing visual Studio 6.0 project

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Christof Fleischmann
Posts: 1
Joined: Tue, 2004-11-23, 16:18

linking dcmtk to existing visual Studio 6.0 project

#1 Post by Christof Fleischmann »

Maybe stupid question.
I try to link dcmtk library to an existing C++ project (Visual Studio 6.0)

Just as example:
I place

#include "dcddirif.h"

test::testfunction()
{
DicomDirInterface MyDicomDirInterface;
}

into my code and add
dcmdata.lib (Objekt-Bibiliothek_Module)
to the Linker list


Now I get following linker error. So it seems that dcmdata.lib has already statically linked MSVC... dlls. What I am doing wrong? :?: :!:
:?:
With best regards Christof

msvcprtd.lib(MSVCP60D.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_strin
g@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) bereits in dcmdata.lib(dcddirif.obj) definiert
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: virtual __thiscall std::basic_ios<char,struct std::char_traits<char> >::~basic_ios<char,struct std::char_traits<char> >(void)" (??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ) bereits in dcmda
ta.lib(dcddirif.obj) definiert
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: void __thiscall std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::`vbase destructor'(void)" (??_D?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D
@2@@std@@QAEXXZ) bereits in dcmdata.lib(dcddirif.obj) definiert
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(vo
id)const " (?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ) bereits in dcmdata.lib(dcddirif.obj) definiert
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??6std@@YAAAV?$basic_ostream@DU?$cha
r_traits@D@std@@@0@AAV10@PBD@Z) bereits in dcmdata.lib(dcddirif.obj) definiert
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::operator<<(int)" (??6?$basic_ostream@DU?$char_traits@D@std@@@std
@@QAEAAV01@H@Z) bereits in dcmdata.lib(dcddirif.obj) definiert
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::operator<<(unsigned int)" (??6?$basic_ostream@DU?$char_traits@D@
std@@@std@@QAEAAV01@I@Z) bereits in dcmdata.lib(dcddirif.obj) definiert
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::operator<<(unsigned short)" (??6?$basic_ostream@DU?$char_traits@
D@std@@@std@@QAEAAV01@G@Z) bereits in dcmdata.lib(dcitem.obj) definiert
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::flush(void)" (?flush@?$basic_ostream@DU?$char_traits@D@std@@@std
@@QAEAAV12@XZ) bereits in dcmdata.lib(dcddirif.obj) definiert
...
...
...
..

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

#2 Post by Marco Eichelberg »

Hmm... I thought this was already covered in the FAQ, but it seems not to.
The problem is that Visual C++ comes with two different, incompatible iostream libraries, and you have to compile all parts of your project consistently with one or the other. It seems that you are mixing the two libraries here.
Try removing the line "#define USE_STD_CXX_INCLUDES" in config/include/cfwin32.h, recompile the complete DCMTK and compile and link your project again.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest