FAQ40 and MS Visual C++ 2008 Express Edition

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Riczi
Posts: 6
Joined: Fri, 2008-08-01, 09:44
Location: Germany

FAQ40 and MS Visual C++ 2008 Express Edition

#1 Post by Riczi »

Hello!
I try to use dcmtk for an own application. To begin with I tried FAQ 40 after some failure of my own trials.

So, I followed the instructions in FAQ 40 and I have also read FAQ 26 and 27. Problems occur during linking of the testapp!

Compiling is no problem. Nevertheless I still cannot resolve the linker problems and I do not know why. I appreciate any hint.

This is the error message:

------ Erstellen gestartet: Projekt: testapp, Konfiguration: Release Win32 ------
Verknüpfen...
dcmdata.lib(dcistrmz.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_inflateEnd" in Funktion ""public: virtual __thiscall DcmZLibInputFilter::~DcmZLibInputFilter(void)" (??1DcmZLibInputFilter@@UAE@XZ)".
dcmdata.lib(dcistrmz.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_inflate" in Funktion ""private: unsigned long __thiscall DcmZLibInputFilter::decompress(void const *,unsigned long)" (?decompress@DcmZLibInputFilter@@AAEKPBXK@Z)".
dcmdata.lib(dcistrmz.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_inflateInit2_" in Funktion ""public: __thiscall DcmZLibInputFilter::DcmZLibInputFilter(void)" (??0DcmZLibInputFilter@@QAE@XZ)".
dcmdata.lib(dcistrmz.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_inflateInit_" in Funktion ""public: __thiscall DcmZLibInputFilter::DcmZLibInputFilter(void)" (??0DcmZLibInputFilter@@QAE@XZ)".
dcmdata.lib(dcostrmz.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_deflateEnd" in Funktion ""public: virtual __thiscall DcmZLibOutputFilter::~DcmZLibOutputFilter(void)" (??1DcmZLibOutputFilter@@UAE@XZ)".
dcmdata.lib(dcostrmz.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_deflate" in Funktion ""private: unsigned long __thiscall DcmZLibOutputFilter::compress(void const *,unsigned long,bool)" (?compress@DcmZLibOutputFilter@@AAEKPBXK_N@Z)".
dcmdata.lib(dcostrmz.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_deflateInit2_" in Funktion ""public: __thiscall DcmZLibOutputFilter::DcmZLibOutputFilter(void)" (??0DcmZLibOutputFilter@@QAE@XZ)".
C:\Programme\dicom\testapp\bin\Release\testapp.exe : fatal error LNK1120: 7 nicht aufgelöste externe Verweise.
Das Buildprotokoll wurde unter "file://c:\Programme\dicom\testapp\testapp.dir\Release\BuildLog.htm" gespeichert.
testapp - 8 Fehler, 0 Warnung(en)
========== Erstellen: 0 erfolgreich, Fehler bei 1, 1 aktuell, 0 übersprungen ==========

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

#2 Post by Marco Eichelberg »

The unresolved symbols are related to zlib. You either have to link the appropriate version of zlib (which is provided as part of the "external libraries" package) or have to configure DCMTK using CMake to not use zlib (in which case support for the Deflate Transfer Syntax will be disabled).

Riczi
Posts: 6
Joined: Fri, 2008-08-01, 09:44
Location: Germany

#3 Post by Riczi »

Thanks for the answer! Meanwhile I discovered that I get the same error under MS Visual Studio 6 as well.

I cannot find out why the zlib version I link should not be correct. It was downloaded from the dcmtk site ("Für Windows Benutzer gibt es die von DCMTK verwendeten externen Bibliotheken (zlib 1.2.3, libtiff 3.7.4, libpng 1.2.8, libxml2 2.6.26 mit libiconv 1.9.1 und OpenSSL 0.9.8a) auch in vorkompilierter Form."). That should be alright...

Therefore, I tried to disable zlib like this: I rebuild the project dcmtk-3.5.4 after setting zlib in CMake to off beforehand. Than build install again and rebuild testapp. After this procedure the errormessage remains unchanged, as far as I can see.
complete error message (after cleaning the testapp project:)
------ Neues Erstellen gestartet: Projekt: ZERO_CHECK, Konfiguration: Release Win32 ------
Die Zwischen- und Ausgabedateien für das Projekt "ZERO_CHECK" mit der Konfiguration "Release|Win32" werden gelöscht.
Checking Build System
CMake does not need to re-run because CMakeFiles/generate.stamp is up-to-date.
Das Buildprotokoll wurde unter "file://c:\Programme\dicom\testapp\ZERO_CHECK.dir\Release\BuildLog.htm" gespeichert.
ZERO_CHECK - 0 Fehler, 0 Warnung(en)
------ Neues Erstellen gestartet: Projekt: testapp, Konfiguration: Release Win32 ------
Die Zwischen- und Ausgabedateien für das Projekt "testapp" mit der Konfiguration "Release|Win32" werden gelöscht.
Building Custom Rule C:/Programme/dicom/testapp/CMakeLists.txt
CMake does not need to re-run because CMakeFiles/generate.stamp is up-to-date.
Kompilieren...
cl : Befehlszeile warning D9002 : Unbekannte Option "/YX" wird ignoriert.
testapp.cxx
Verknüpfen...
dcmdata.lib(dcistrmz.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_inflateEnd" in Funktion ""public: virtual __thiscall DcmZLibInputFilter::~DcmZLibInputFilter(void)" (??1DcmZLibInputFilter@@UAE@XZ)".
dcmdata.lib(dcistrmz.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_inflate" in Funktion ""private: unsigned long __thiscall DcmZLibInputFilter::decompress(void const *,unsigned long)" (?decompress@DcmZLibInputFilter@@AAEKPBXK@Z)".
dcmdata.lib(dcistrmz.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_inflateInit2_" in Funktion ""public: __thiscall DcmZLibInputFilter::DcmZLibInputFilter(void)" (??0DcmZLibInputFilter@@QAE@XZ)".
dcmdata.lib(dcistrmz.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_inflateInit_" in Funktion ""public: __thiscall DcmZLibInputFilter::DcmZLibInputFilter(void)" (??0DcmZLibInputFilter@@QAE@XZ)".
dcmdata.lib(dcostrmz.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_deflateEnd" in Funktion ""public: virtual __thiscall DcmZLibOutputFilter::~DcmZLibOutputFilter(void)" (??1DcmZLibOutputFilter@@UAE@XZ)".
dcmdata.lib(dcostrmz.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_deflate" in Funktion ""private: unsigned long __thiscall DcmZLibOutputFilter::compress(void const *,unsigned long,bool)" (?compress@DcmZLibOutputFilter@@AAEKPBXK_N@Z)".
dcmdata.lib(dcostrmz.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_deflateInit2_" in Funktion ""public: __thiscall DcmZLibOutputFilter::DcmZLibOutputFilter(void)" (??0DcmZLibOutputFilter@@QAE@XZ)".
C:\Programme\dicom\testapp\bin\Release\testapp.exe : fatal error LNK1120: 7 nicht aufgelöste externe Verweise.
Das Buildprotokoll wurde unter "file://c:\Programme\dicom\testapp\testapp.dir\Release\BuildLog.htm" gespeichert.
testapp - 8 Fehler, 1 Warnung(en)
------ Neues Erstellen übersprungen: Projekt: ALL_BUILD, Konfiguration: Release Win32 ------
Für diese Projektmappenkonfiguration wurde kein zu erstellendes Projekt ausgewählt.
========== Alles neu erstellen: 1 erfolgreich, Fehler bei 1, 1 übersprungen ==========

Riczi
Posts: 6
Joined: Fri, 2008-08-01, 09:44
Location: Germany

#4 Post by Riczi »

Eventually I could solve the problem. But I do not really understand the background:
With the given hint, I found out that I also have to link the zlib-1.2.3 library explicitly within my testapp (under object/library modules AND library path).

Is it like this:
When you link the library for buidling the dcmtk project (via cmake) you also have to link it in your aplication when you use e.g. dcmdata.lib? I thought linking the library zlib when building dcmtk would be enough...

Best regards
Riczi

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#5 Post by Jörg Riesmeier »

When you link the library for buidling the dcmtk project (via cmake) you also have to link it in your aplication when you use e.g. dcmdata.lib?
Yes, since dcmdata in this case depends on zlib and the linker cannot resolve the external references if you omit this library for your application.
I thought linking the library zlib when building dcmtk would be enough...
No, you also have to link this library to your application (see examples in the "apps" folders).

Riczi
Posts: 6
Joined: Fri, 2008-08-01, 09:44
Location: Germany

#6 Post by Riczi »

I know from your comments in the forum, that you always wish that everybody has read the documentation thoroughly before asking. Nevertheless, I am sorry, I do not know where that folder app is... (':oops:')

I wonder if there are possibilities to ease the use and installation of dcmtk. The framework (with CMake etc.) is very good but installation still needs a few rather tricky (and time consuming) bits.
E.g.: it took me a while to find out how to access the usually hidden switches in CMake to set all of the important ones to Multithreaded. In addition I could not solve the linker problem by myself, because of that misunderstanding.

Best regards
Riczi

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#7 Post by Jörg Riesmeier »

I know from your comments in the forum, that you always wish that everybody has read the documentation thoroughly before asking.
Good observation :-) Reading the INSTALL file should preferably be the first step for all new DCMTK developers.
Nevertheless, I am sorry, I do not know where that folder app is...
Most DCMTK modules contain an "apps" subfolder (e.g. dcmdata/apps) with example applications. There you can also find working examples for GNU make and CMake files.
In addition I could not solve the linker problem by myself, because of that misunderstanding.
For example, FAQ #27 refers to this issue (linking internal and external libraries), but I have to admit that the reported Linker error number is different.
Last edited by Jörg Riesmeier on Fri, 2009-06-12, 10:58, edited 1 time in total.

Riczi
Posts: 6
Joined: Fri, 2008-08-01, 09:44
Location: Germany

#8 Post by Riczi »

Thank you!
By the way I discovered the next problem which took a lot of time to solve:

I used dcmtk libraries which were built with VS Studio 6.0 in a testapp project in VS Visual Express 2008 and it was impossible to build the testapp.
But using the dcmtk libraries built with Visual Express 2008 it was no problem to build the same testapp in MS Visual C++ Express 2008. But I blame that on MS of course (and not on you)! :wink:

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest