# LNK4098 use /NODEFAULTLIB:library

**URL:** https://discourse.cmake.org/t/lnk4098-use-nodefaultlib-library/5427
**Category:** Usage
**Tags:** os:windows
**Created:** [April 11, 2022, 7:20am UTC](https://discourse.cmake.org/t/lnk4098-use-nodefaultlib-library/5427 "2022-04-11T07:20:47Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![alice](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alice/32/1615_2.png) [@alice](https://discourse.cmake.org/u/alice)
#### Post date: [April 11, 2022, 7:20am UTC](https://discourse.cmake.org/t/lnk4098-use-nodefaultlib-library/5427/1 "2022-04-11T07:20:47Z")

</div>

I try to use

```auto
ninja -j4 project

```

It happen this error. I search some comment and it say use vs2019 to setting [cpp-docs/nodefaultlib-ignore-libraries.md at main · MicrosoftDocs/cpp-docs · GitHub](https://github.com/MicrosoftDocs/cpp-docs/blob/main/docs/build/reference/nodefaultlib-ignore-libraries.md)  
But I use the command line without IDE.

I direct input `/NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib `  
The filename, directory name, or volume label syntax is incorrect.

```auto
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs;
use /NODEFAULTLIB:library comet.exe : fatal error LNK1169: one or more multiply defined symbols found 
ninja: build stopped: subcommand failed.

```

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [April 12, 2022, 11:46am UTC](https://discourse.cmake.org/t/lnk4098-use-nodefaultlib-library/5427/2 "2022-04-12T11:46:01Z")

</div>

Those flags should be passed to `target_linker_options()` for the target in question. This sounds like a mixed release/debug environment which is tricky to get to work. I really recommend using `RelWithDebInfo` if possible (or `Debug` for the whole stack if it is really necessary).

---

<div class="post-metadata">

### Author: ![alice](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alice/32/1615_2.png) [@alice](https://discourse.cmake.org/u/alice)
#### Post date: [April 13, 2022, 5:52am UTC](https://discourse.cmake.org/t/lnk4098-use-nodefaultlib-library/5427/3 "2022-04-13T05:52:07Z")

</div>

So the `/NODEFAULTLIB:library`  
doesn’t have command line

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [April 13, 2022, 8:51pm UTC](https://discourse.cmake.org/t/lnk4098-use-nodefaultlib-library/5427/4 "2022-04-13T20:51:34Z")

</div>

I don’t know what you’re asking here (if anything). It should be passed to the compiler, but CMake has no abstraction for it.

---

<div class="post-metadata">

### Author: ![alice](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alice/32/1615_2.png) [@alice](https://discourse.cmake.org/u/alice)
#### Post date: [August 10, 2022, 8:17am UTC](https://discourse.cmake.org/t/lnk4098-use-nodefaultlib-library/5427/5 "2022-08-10T08:17:16Z")

</div>

> **[/NODEFAULTLIB (Ignore Libraries)](https://docs.microsoft.com/en-us/cpp/build/reference/nodefaultlib-ignore-libraries?view=msvc-170)**
>
> Learn more about: /NODEFAULTLIB (Ignore Libraries)

vs have the toutrial to close or open the /NODEFAULTLIB:library  
But it use the vs interface.  
So /NODEFAULTLIB:library  
Does it has the command line to open it or close
