# link error (LNK2019)

**URL:** https://discourse.itk.org/t/link-error-lnk2019/1865
**Category:** Engineering
**Created:** [May 13, 2019, 6:56am UTC](https://discourse.itk.org/t/link-error-lnk2019/1865 "2019-05-13T06:56:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![eninyo](https://discourse.itk.org/letter_avatar_proxy/v4/letter/e/f9ae1b/32.png) [@eninyo](https://discourse.itk.org/u/eninyo)
#### Post date: [May 13, 2019, 6:56am UTC](https://discourse.itk.org/t/link-error-lnk2019/1865/1 "2019-05-13T06:56:58Z")

</div>

hi,  
i get the following error:  
ofstd.lib(ofstd.obj)👎 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,

---

<div class="post-metadata">

### Author: ![Niels\_Dekker](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/9d8465/32.png) [@Niels\_Dekker](https://discourse.itk.org/u/Niels_Dekker)
#### Post date: [May 14, 2019, 2:36pm UTC](https://discourse.itk.org/t/link-error-lnk2019/1865/2 "2019-05-14T14:36:04Z")

</div>

Hi Eliah,

> [@eninyo](#):
>
> get the following error:  
> ofstd.lib(ofstd.obj)👎 error: LNK2019: unresolved external symbol NetWkstaUserGetInfo

Hmm… the linker giving you a thumb down (👎)… how is that possible? 😉

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:

> **[NetWkstaUserGetInfo function (lmwksta.h) - Win32 apps](https://learn.microsoft.com/en-us/windows/win32/api/lmwksta/nf-lmwksta-netwkstausergetinfo)**
>
> The NetWkstaUserGetInfo function returns information about the currently logged-on user. This function must be called in the context of the logged-on user.

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

Hope that helps!

---

<div class="post-metadata">

### Author: ![fbudin](https://discourse.itk.org/user_avatar/discourse.itk.org/fbudin/32/14_2.png) [@fbudin](https://discourse.itk.org/u/fbudin)
#### Post date: [May 14, 2019, 5:06pm UTC](https://discourse.itk.org/t/link-error-lnk2019/1865/3 "2019-05-14T17:06:21Z")

</div>

@eninyo: [This patch](https://github.com/InsightSoftwareConsortium/ITK/commit/1b18eacaab33c798b75cda57b0eeaa9e028c7141) 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
