Linker Error LNK2019 with VS 2005

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Klaus Schlosser
Posts: 2
Joined: Tue, 2006-03-28, 08:34
Location: Landau, Germany

Linker Error LNK2019 with VS 2005

#1 Post by Klaus Schlosser »

I've created a Test Project as described in FAQ #40. The complete DCMTK Toolkit with all options compiled, linked and installed without problems.

But when i wanted to build my Tesproject i got many Linker Errors.

------ Build started: Project: testapp, Configuration: Debug Win32 ------
Linking...
dcmdata.lib(dcistrmz.obj) : error LNK2019: unresolved external symbol _inflateInit2_ referenced in function "public: __thiscall DcmZLibInputFilter::DcmZLibInputFilter(void)" (??0DcmZLibInputFilter@@QAE@XZ)
dcmdata.lib(dcistrmz.obj) : error LNK2019: unresolved external symbol _inflateInit_ referenced in function "public: __thiscall DcmZLibInputFilter::DcmZLibInputFilter(void)" (??0DcmZLibInputFilter@@QAE@XZ)
dcmdata.lib(dcistrmz.obj) : error LNK2019: unresolved external symbol _inflateEnd referenced in function "public: virtual __thiscall DcmZLibInputFilter::~DcmZLibInputFilter(void)" (??1DcmZLibInputFilter@@UAE@XZ)
dcmdata.lib(dcistrmz.obj) : error LNK2019: unresolved external symbol _inflate referenced in function "private: unsigned long __thiscall DcmZLibInputFilter::decompress(void const *,unsigned long)" (?decompress@DcmZLibInputFilter@@AAEKPBXK@Z)
dcmdata.lib(dcostrmz.obj) : error LNK2019: unresolved external symbol _deflateInit2_ referenced in function "public: __thiscall DcmZLibOutputFilter::DcmZLibOutputFilter(void)" (??0DcmZLibOutputFilter@@QAE@XZ)
dcmdata.lib(dcostrmz.obj) : error LNK2019: unresolved external symbol _deflateEnd referenced in function "public: virtual __thiscall DcmZLibOutputFilter::~DcmZLibOutputFilter(void)" (??1DcmZLibOutputFilter@@UAE@XZ)
dcmdata.lib(dcostrmz.obj) : error LNK2019: unresolved external symbol _deflate referenced in function "private: unsigned long __thiscall DcmZLibOutputFilter::compress(void const *,unsigned long,bool)" (?compress@DcmZLibOutputFilter@@AAEKPBXK_N@Z)
Debug\testapp.exe : fatal error LNK1120: 7 unresolved externals
Build log was saved at "file://c:\Projekte\bitex\Testdcm\testapp.dir\Debug\BuildLog.htm"
testapp - 8 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Can somebody help me ?
Software Developer

Michael Onken
DCMTK Developer
Posts: 2054
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#2 Post by Michael Onken »

Hi Mr. Schlosser,

it seems that you compiled DCMTK with zlib support. So you have to add zlib to the libraries linked to your application.

Change two lines in your CMAKE file (or add zlib directly in Visual Studio to your project settings):
LINK_DIRECTORIES(${DCMTK_DIR}/lib HERE_GOES_YOUR_ZLIB_DIR)
TARGET_LINK_LIBRARIES(testapp netapi32 wsock32 ofstd dcmdata zlib_o)
You can get all support libraries (like zlib) precompiled from the DCMTK website. If you want to compile your project in debug mode, change zlib_o to zlib_d above. If you need more information, try to search "zlib" in the forum.

Regards,
Michael

Klaus Schlosser
Posts: 2
Joined: Tue, 2006-03-28, 08:34
Location: Landau, Germany

#3 Post by Klaus Schlosser »

Thank You. It Works fine now.

I recommend to use CMake to set the numerous compiler and linker options instead of trying out manually ;-)
Software Developer

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest