link error (LNK2019)

(Eliah Ninyo) #1

hi,
i get the following error:
ofstd.lib(ofstd.obj):-1: error: LNK2019: unresolved external symbol NetWkstaUserGetInfo referenced in function “public: static class OFString __cdecl OFStandard::getUserName(void)” (?getUserName@OFStandard@@SA?AVOFString@@XZ) File not found: ofstd.lib (ofstd.obj)

i’m using dcmtk version 3.6.4 and itk 4.13.2.
i used cmake to compile them as static libs (not shared).

anyone know why i get this error? what can i do?

thank in advance,

(Niels Dekker) #2

Hi Eliah,

Hmm… the linker giving you a thumb down (:-1:)… how is that possible? :wink:

Does it help if you add “netapi32.lib” to your linker input files?

For example, by adding a #pragma to your source file:

#pragma comment(lib, "netapi32.lib")

As suggested here:

Or (probably preferable) by adding “netapi32.lib” to the target_link_libraries of your CMakeLists.txt…

Hope that helps!

(Francois Budin) #3

@eninyo: This patch should solve your problem. A dependency was missing and was added in the patch. If you have this error while building ITK, you can solve it by applying the patch I mention above. If you are having this error while compiling an application that is based on ITK/DCMTK, you might be able to work around this issue by adding the missing dependencies directly in your application. The missing dependencies on Windows are: iphlpapi ws2_32 netapi32 wsock32

2 Likes
ITK with DCMTK building error