# CMake Generated VS 2022 Project File references to the library "rt.lib" instead of "msvcrt.lib"

**URL:** https://discourse.cmake.org/t/cmake-generated-vs-2022-project-file-references-to-the-library-rt-lib-instead-of-msvcrt-lib/15155
**Category:** Usage
**Tags:** os:windows
**Created:** [September 6, 2025, 10:26pm UTC](https://discourse.cmake.org/t/cmake-generated-vs-2022-project-file-references-to-the-library-rt-lib-instead-of-msvcrt-lib/15155 "2025-09-06T22:26:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![darbysobha](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/3bc359/32.png) [@darbysobha](https://discourse.cmake.org/u/darbysobha)
#### Post date: [September 6, 2025, 10:26pm UTC](https://discourse.cmake.org/t/cmake-generated-vs-2022-project-file-references-to-the-library-rt-lib-instead-of-msvcrt-lib/15155/1 "2025-09-06T22:26:02Z")

</div>

Hello,

When I build my project, I get the following error message:

`LINK : fatal error LNK1181: cannot open input file 'rt.lib' [D:\conan2-libraries\hdbreader-source\build-release\src\tests\SavecaseReader_unittest\SavecaseReader_unittest.vcxproj]`

I tried setting the following in my CMakeLists.txt file.

```auto
cmake_policy(SET CMP0091 NEW)
..
..
set_target_property(${target_name} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")

```

But no effect.

Also tried the following:

```auto
target_link_options(${target_name} PRIVATE "/NODEFAULTLIB:rt.lib") 
set_target_properties(${target_name} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:rt.lib") 

```

But no impact.

If I manually edit the generated Visual Studio Project file to use “msvcrt.lib”, it builds.

Actually, there is no library file named “rt.lib”.

I am using cmake Version 3.26.4. Also tried with CMake 3.31.8 without Success.

This issue is not there with VS 2019 & CMake 22.3. It builds successfully with CMake Version3.22.3 with Visual Studio 2019.

---

<div class="post-metadata">

### Author: ![darbysobha](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/3bc359/32.png) [@darbysobha](https://discourse.cmake.org/u/darbysobha)
#### Post date: [September 8, 2025, 3:46am UTC](https://discourse.cmake.org/t/cmake-generated-vs-2022-project-file-references-to-the-library-rt-lib-instead-of-msvcrt-lib/15155/2 "2025-09-08T03:46:07Z")

</div>

I was able to resolve the issue. Actually, it was referring to librt.so

It was my mistake and I didn’t put the Cmake Generator Exression for GNU Compilation only.
