# Compiler identification problem (VS2022)

**URL:** https://discourse.cmake.org/t/compiler-identification-problem-vs2022/5149
**Category:** Usage
**Tags:** os:windows
**Created:** [March 2, 2022, 5:17pm UTC](https://discourse.cmake.org/t/compiler-identification-problem-vs2022/5149 "2022-03-02T17:17:17Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![hyperz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hyperz/32/2239_2.png) [@hyperz](https://discourse.cmake.org/u/hyperz)
#### Post date: [March 2, 2022, 5:17pm UTC](https://discourse.cmake.org/t/compiler-identification-problem-vs2022/5149/1 "2022-03-02T17:17:17Z")

</div>

I have installed VS2022 and Windows SDK. There is VS2017 previously installed.

I am running cmake-gui (3.22.2) on some project and try to configure it. I can’t get past the compiler identification.

When I examined the CMakeError.log file there is this error:  
LINK : fatal error LNK1104: cannot open file ‘ucrtd.lib’

This library comes from the installed Windows SDK. It seems there is an annoying bug in VS2022 which doesn’t add all required library folders into the compiler LIBPATH. This happens even in the IDE but there I am able to add missing folders in the project settings.

How to configure library search folder for the compiler identification step? I tried to set CMAKE\_EXE\_LINKER\_FLAGS=/LIBPATH:path-to-missing-lib-folder but it didn’t help. Maybe this variable is not used for the compiler identification step.

Any idea how to fix this?

---

<div class="post-metadata">

### Author: ![buildSystemPerson](https://discourse.cmake.org/user_avatar/discourse.cmake.org/buildsystemperson/32/2851_2.png) [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)
#### Post date: [March 2, 2022, 5:59pm UTC](https://discourse.cmake.org/t/compiler-identification-problem-vs2022/5149/2 "2022-03-02T17:59:25Z")

</div>

Ignore the error log for now. What does the console output say?

---

<div class="post-metadata">

### Author: ![hyperz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hyperz/32/2239_2.png) [@hyperz](https://discourse.cmake.org/u/hyperz)
#### Post date: [March 3, 2022, 6:49am UTC](https://discourse.cmake.org/t/compiler-identification-problem-vs2022/5149/3 "2022-03-03T06:49:14Z")

</div>

Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.  
The C compiler identification is unknown  
The CXX compiler identification is unknown  
CMake Error at CMakeLists.txt:2 (project):  
No CMAKE\_C\_COMPILER could be found.

CMake Error at CMakeLists.txt:2 (project):  
No CMAKE\_CXX\_COMPILER could be found.

Configuring incomplete, errors occurred!  
See also “C:/work/opendrive-convertor/work22/CMakeFiles/CMakeOutput.log”.  
See also “C:/work/opendrive-convertor/work22/CMakeFiles/CMakeError.log”.

---

<div class="post-metadata">

### Author: ![buildSystemPerson](https://discourse.cmake.org/user_avatar/discourse.cmake.org/buildsystemperson/32/2851_2.png) [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)
#### Post date: [March 4, 2022, 12:11am UTC](https://discourse.cmake.org/t/compiler-identification-problem-vs2022/5149/4 "2022-03-04T00:11:47Z")

</div>

Never mind that wasn’t actually that helpful of advice I gave

Here is what I found on the web:

- [c++ - LINK : fatal error LNK1104: cannot open file 'ucrtd.lib' in VS2017 RC - Stack Overflow](https://stackoverflow.com/questions/40757804/link-fatal-error-lnk1104-cannot-open-file-ucrtd-lib-in-vs2017-rc)
- [LNK1104 cannot open file 'ucrtd.lib'](https://social.msdn.microsoft.com/Forums/en-US/7a2f61b7-3c01-4767-9a30-e897dc240e60/lnk1104-cannot-open-file-ucrtdlib)
- [visual studio - CMake cannot open "ucrtd.lib" - Stack Overflow](https://stackoverflow.com/questions/56145118/cmake-cannot-open-ucrtd-lib)

Otherwise try re-refreshing your visual studio installation and ensure you have all the necessary components for building a C++ project.

Try using the repair option.

BTW does this issue happen for both VS2017/VS2022 ?

---

<div class="post-metadata">

### Author: ![buildSystemPerson](https://discourse.cmake.org/user_avatar/discourse.cmake.org/buildsystemperson/32/2851_2.png) [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)
#### Post date: [March 4, 2022, 12:15am UTC](https://discourse.cmake.org/t/compiler-identification-problem-vs2022/5149/5 "2022-03-04T00:15:07Z")

</div>

If that still doesn’t help at all provide a complete log of what’s happening.

```auto
cd your_project

# Delete your old build folder
rm build

# Make a new vs solution, and redirect all output to a file.
cmake -S . -B build --trace-expand *> log.txt

```

---

<div class="post-metadata">

### Author: ![hyperz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hyperz/32/2239_2.png) [@hyperz](https://discourse.cmake.org/u/hyperz)
#### Post date: [March 4, 2022, 9:00am UTC](https://discourse.cmake.org/t/compiler-identification-problem-vs2022/5149/6 "2022-03-04T09:00:57Z")

</div>

Today I installed a new version of Windows SDK through VS installer. Everything started working.

I think there is a problem with SDK 10.0.19041.0 which is the default SDK for VS 2022. When using this SDK compiler doesn’t get complete library paths so it fails when looking for ucrtd.lib. I can see that $(WindowsSDK\_LibraryPath\_x64) misses ucrt directory. Installation of new SDK fixes this. It looks like a msbuild’s internal SDK-detection problem.

---

<div class="post-metadata">

### Author: ![buildSystemPerson](https://discourse.cmake.org/user_avatar/discourse.cmake.org/buildsystemperson/32/2851_2.png) [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)
#### Post date: [March 5, 2022, 2:15am UTC](https://discourse.cmake.org/t/compiler-identification-problem-vs2022/5149/7 "2022-03-05T02:15:43Z")

</div>

Good to hear you could fix your problem by installing a new version of the SDK 👍

If you have some time consider responding to this stack overflow question since the question is so similar and your answer is much better:

[visual studio - CMake cannot open “ucrtd.lib” - Stack Overflow](https://stackoverflow.com/questions/56145118/cmake-cannot-open-ucrtd-lib)

Also consider filing an issue with the VS team.
