Error from making DICOM example

When I make DICOM based on DCMTK, I get the following error:

This has bothered me for a long time, how can I solve it? Thank you very much for your advice, which will be very helpful to me .

1 Like

The error is down to the installed libdcmdata.a static library not being compiled with position independent code (PIC), and thus it can’t be linked to the example’s shared library.

The example illustrates some rather advanced CMake usage for multi project builds, so I’d suggest trying to reinstall DCMTK with shared rather than static libraries. I’m not super familiar with DCMTK, but based on the info on this support page, that should be possible by configuring the build of DCMTK using:

$ cmake -DBUILD_SHARED_LIBS=ON <otherDCMTKopts>
$ make install

It should thence possible to build the DICOM example from scratch, pointing it to this fresh install.

Thank you very much for your advice. It really helps. However, another error occurs when linking the DICOM example:

How to solve this error?