DCMTK + DCMPRINT : LNK2019 errors

Questions regarding the DCMPRINT library, a DCMTK add-on that implements a DICOM Print Management SCP and SCU

Moderator: Moderator Team

Post Reply
Message
Author
ruben.cruz
Posts: 39
Joined: Fri, 2019-05-03, 15:06

DCMTK + DCMPRINT : LNK2019 errors

#1 Post by ruben.cruz » Wed, 2021-03-31, 14:50

Hi

I am using DCMPRINT version 3.6.4.

Well, I'm having a problem with dcmtk + dcmprint where there are LNK2019 errors even if you don't have anything in my main, dcmtk's include's are enought to throw errors. I read that this can be generated by the lack of libs in the linker or by their order, but I think i have this part right. I'm going to add some prints of my code and the linker.
Image Image Image Image

If you detect something wrong, please correct me.
Looking forward your reply. Thanks!

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

Re: DCMTK + DCMPRINT : LNK2019 errors

#2 Post by Marco Eichelberg » Tue, 2021-04-06, 14:38

The error message indeed indicates that the linker cannot resolve some symbols, either because a library is missing, or because the link order is incorrect.
The symbols reported in the error message are present in the ofstd library (ofstd.lib), and I cannot see that library in the list of library dependencies in your screenshot, so perhaps you simply need to add this.
The symbols reported in the error messages somewhere in the lower part of the screenshot are related to oflog.lib, which may also be missing.
As a rule of thumb, when working with DCMTK you will always need to link against ofstd.lib and oflog.lib, since these provide basic functions that are used everywhere in the toolkit.

And yes, you are right: Including header files can be enough to create library dependencies. That is a typical C++ feature that you probably won't find in pure C code.

ruben.cruz
Posts: 39
Joined: Fri, 2019-05-03, 15:06

Re: DCMTK + DCMPRINT : LNK2019 errors

#3 Post by ruben.cruz » Tue, 2021-04-06, 14:48

Ty for your help.
U can see in the print under "wsock32.lib" (line 5 and 6) they are both there.
What else could cause this problem?

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

Re: DCMTK + DCMPRINT : LNK2019 errors

#4 Post by Marco Eichelberg » Tue, 2021-04-06, 14:59

Then it's probably the link order. The libraries needed for the print client should be specified in this order:

Code: Select all

dcmprint.lib
dcmimage.lib
dcmimgle.lib
dcmnet.lib
dcmtls.lib
dcmdata.lib
oflog.lib
ofstd.lib

ruben.cruz
Posts: 39
Joined: Fri, 2019-05-03, 15:06

Re: DCMTK + DCMPRINT : LNK2019 errors

#5 Post by ruben.cruz » Tue, 2021-04-06, 15:11

I have tried that and it made no diference. Im starting to think that it is a vs problem...

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

Re: DCMTK + DCMPRINT : LNK2019 errors

#6 Post by Marco Eichelberg » Tue, 2021-04-06, 15:30

Possible. You might want to check the command line options used to build DCMTK and compare these with the settings of your own project. There are some command line options that are mutually incompatible, such as /Gd, /Gr, /Gv, /Gz, which change the calling conventions (e.g. __thiscall, __fastcall, __stdcall) for functions.

ruben.cruz
Posts: 39
Joined: Fri, 2019-05-03, 15:06

Re: DCMTK + DCMPRINT : LNK2019 errors

#7 Post by ruben.cruz » Tue, 2021-04-06, 16:32

I left all of that default

ruben.cruz
Posts: 39
Joined: Fri, 2019-05-03, 15:06

Re: DCMTK + DCMPRINT : LNK2019 errors

#8 Post by ruben.cruz » Tue, 2021-04-06, 17:38

Marco Eichelberg wrote:
Tue, 2021-04-06, 15:30
Possible. You might want to check the command line options used to build DCMTK and compare these with the settings of your own project. There are some command line options that are mutually incompatible, such as /Gd, /Gr, /Gv, /Gz, which change the calling conventions (e.g. __thiscall, __fastcall, __stdcall) for functions.

Where can i check this? Im lost

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

Re: DCMTK + DCMPRINT : LNK2019 errors

#9 Post by Marco Eichelberg » Wed, 2021-04-07, 08:00

Sorry, I haven't used Visual Studio for years, I cannot say exactly where you can look that up. I remember that you can, though...

ruben.cruz
Posts: 39
Joined: Fri, 2019-05-03, 15:06

Re: DCMTK + DCMPRINT : LNK2019 errors

#10 Post by ruben.cruz » Wed, 2021-04-07, 14:33

I've found out that it is compiling using "/Gd".
Image
Now i'm trying to figure out how to remove that option, since, it's using the default
Last edited by ruben.cruz on Wed, 2021-04-07, 15:45, edited 1 time in total.

ruben.cruz
Posts: 39
Joined: Fri, 2019-05-03, 15:06

Re: DCMTK + DCMPRINT : LNK2019 errors

#11 Post by ruben.cruz » Wed, 2021-04-07, 15:44

I managed to make it work but now im having this error...
Image
can u help me with this?

ruben.cruz
Posts: 39
Joined: Fri, 2019-05-03, 15:06

Re: DCMTK + DCMPRINT : LNK2019 errors

#12 Post by ruben.cruz » Thu, 2021-04-08, 14:12

I already fixed this by recompilind all libs with the "shared libs option" off and "overwrite flags" off and is running but im having a problem while connecting to it using your client.
Image

do u know what might be causing this error?

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

Re: DCMTK + DCMPRINT : LNK2019 errors

#13 Post by Marco Eichelberg » Wed, 2021-05-19, 16:02

The print server uses two TCP ports, one for DICOM communication and one for inter-process communication (although the latter one is not really needed in the Windows version). The error message indicates that "somebody" has connected to the IPC port instead of the DICOM port.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests