Linking error during compilation

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Oliver Neubauer
Posts: 19
Joined: Fri, 2014-03-14, 12:43

Linking error during compilation

#1 Post by Oliver Neubauer » Wed, 2014-04-16, 14:11

Hi,

after the download of dcmtk 3.6.0 from your web page (ftp://dicom.offis.de/pub/dicom/offis/so ... -3.6.0.zip), I built the DCMTK project using cmake. I compiled the subprojects "ALL_BUILD" and "INSTALL". After that, the folder "C:\Program Files (x86)\DCMTK" with the subfolder "bin", "etc", "include", "lib" and "share" was created. I guess, that is the appropriate structure, right?

So, I included the source files (folder "include") and the library "dcmdata.lib" in my project.

I wrote the following code in my project:

Code: Select all

#include "dcmtk\config\osconfig.h"
#include "dcmtk\dcmdata\dctk.h"

int main()
{
	OFCondition status;
	DcmFileFormat fileFormat;

	status = fileFormat.loadFile("test.dcm");

	if(status.good())
		std::cout << "File is loaded" << std::endl;
	else
		std::cout << "File not loaded" << std::endl;

	return EXIT_SUCCESS;
}
After compilation, I got several linking errors like this:

error LNK2001: Nicht aufgelöstes externes Symbol ""public: __thiscall OFString::OFString(char const *)" (??0OFString@@QAE@PBD@Z)".

I have seen in FAQ #27, that several external libraries are necessary. Where can I found this libraries? Or is there another solution for this problem?

Thanks.

Best regards,

Oliver

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Linking error during compilation

#2 Post by Jan Schlamelcher » Thu, 2014-04-17, 08:42

Hi Oliver,

you might take a look at this page: http://support.dcmtk.org/wiki/dcmtk/modules/start, which shows that the dcmdata module depends on the modules oflog and ofstd. Therefore you also have to link the respective libraries in you program. The OFString class for example is implemented in the ofstd module.
Oliver Neubauer wrote:Or is there another solution for this problem?
You can set the BUILD_SINGLE_SHARED_LIBRARY option when compiling DCMTK to create a single shared library including all modules of DCMTK.

Best,
Jan

J. Riesmeier
DCMTK Developer
Posts: 2293
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Linking error during compilation

#3 Post by J. Riesmeier » Thu, 2014-04-17, 08:58

To the OP: FAQ #27 also describes the dependencies between the various DCMTK modules/libs (at least for releases prior to DCMTK 3.6.0).
Jan Schlamelcher wrote:You can set the BUILD_SINGLE_SHARED_LIBRARY option when compiling DCMTK to create a single shared library including all modules of DCMTK.
... but this requires a recent development or snapshot version. It does not work with DCMTK 3.6.0.

Oliver Neubauer
Posts: 19
Joined: Fri, 2014-03-14, 12:43

Re: Linking error during compilation

#4 Post by Oliver Neubauer » Thu, 2014-04-17, 09:32

Hi,

thanks for your response. I solved this issue by following post:

viewtopic.php?f=3&t=290

Best regards,

Oliver

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest