# \--rc=rc --mt=CMAKE\_MT-NOTFOUND

**URL:** <https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089>\
**Category:** Development\
**Tags:** os:windows\
**Created:** [February 22, 2022, 3:22pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089 "2022-02-22T15:22:34Z")\
**Posts on this page:** 20\
**Page:** 1

<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:** [February 22, 2022, 3:22pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/1 "2022-02-22T15:22:34Z")

</div>

================================

UPDATE:

I found the cause of the bug!

TLDR: `Registry editing has been disabled by your administrator.`

[Link to the Visual Studio issue with full details](https://developercommunity.visualstudio.com/t/resource-compiler-rcexe-is-not-recognized-as-an-in/1676970)

=================================

I’ve had this problem for a while. So it’s not specific to a CMake release or version of visual studio. It’s just MSVC specific.

When using the native tools command prompts provided by visual studio I’m getting this strange error:

```auto
>cmake -B build/nin -G "Ninja"
-- The CXX compiler identification is MSVC 19.30.30705.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/cmake/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
  The C++ compiler

    "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: D:/foobar/build/nin/CMakeFiles/CMakeTmp

    Run Build Command(s):D:/develop/dk/win/ninja/1.10.2/ninja.exe cmTC_9ce07 && [1/2] Building CXX object CMakeFiles\cmTC_9ce07.dir\testCXXCompiler.cxx.obj
    [2/2] Linking CXX executable cmTC_9ce07.exe
    FAILED: cmTC_9ce07.exe
    cmd.exe /C "cd . && C:\cmake\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_9ce07.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1430~1.307\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_9ce07.dir\testCXXCompiler.cxx.obj /out:cmTC_9ce07.exe /implib:cmTC_9ce07.lib /pdb:cmTC_9ce07.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
    RC Pass 1: command "rc /fo CMakeFiles\cmTC_9ce07.dir/manifest.res CMakeFiles\cmTC_9ce07.dir/manifest.rc" failed (exit code 0) with the following output:
    The system cannot find the file specified
    ninja: build stopped: subcommand failed.

```

Basically CMake fails to build a simple example project due to issues around the [resource compiler](https://docs.microsoft.com/en-us/windows/win32/menurc/resource-compiler) and the CMAKE\_MT program it requires.

---

<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:** [February 22, 2022, 3:25pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/2 "2022-02-22T15:25:47Z")

</div>

It sounds like you have the compiler, but are missing the Windows SDK. You’ll need to install that component in the Visual Studio installer.

---

<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:** [February 22, 2022, 3:30pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/3 "2022-02-22T15:30:14Z")

</div>

I have the Windows SDK installed. I’m able to get Visual Studio Generator builds working fine that use the resource compiler.

---

<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:** [February 22, 2022, 4:35pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/4 "2022-02-22T16:35:08Z")

</div>

Out of curiosity how does CMake find the Resource Compiler? Could it get confused if I have another exe with the name ‘rc.exe’ in my path?

---

<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:** [February 22, 2022, 7:03pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/5 "2022-02-22T19:03:51Z")

</div>

It just expects it to be in `PATH` AFAIK.

---

<div class="post-metadata">

**Author:** ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)\
**Post date:** [February 22, 2022, 8:56pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/6 "2022-02-22T20:56:19Z")

</div>

`vcvarsall.bat` normally puts a Windows SDK in the `PATH`. CMake expects this for command-line buildsystem generators like `Ninja`.

---

<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:** [February 22, 2022, 9:41pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/7 "2022-02-22T21:41:55Z")

</div>

```auto
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.1.0
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************

C:\Program Files\Microsoft Visual Studio\2022\Professional>rc.exe /?
'rc.exe' is not recognized as an internal or external command,
operable program or batch file.

```

Seems like it’s not putting it in my `PATH` I just repaired my VS2022 installation as well.

Normally I’d chalk this down to a (it’s just me) issue. But I’ve had coworkers contact me with the exact same problem. Perhaps this is a VS issue.

---

<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:** [February 23, 2022, 12:37am UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/8 "2022-02-23T00:37:13Z")

</div>

Oh! It might not be the SDK. There’s a “build tools” component that is needed. I think you might need the “Latest” version (with that label, not the highest number).

---

<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:** [February 24, 2022, 1:51pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/9 "2022-02-24T13:51:11Z")

</div>

Here is the list of everything I currently have installed:

- MSVC v143 - VS2022 C++ x64/x86 build tools
- Windows 10 SDK (10.0.19041.0)
- Just-In-Time Debugger
- C++ profiling tools
- C++ CMake tools for Windows
- C++ ATL for latest v143 build tools
- C++ AddressSanitizer
- C++ MFC for latest v143 build tools
- C++/CLI support for v143 build tools
- C++ Modules for v143 build tools

Yet I still get the aforementioned errors. I’m going to try completely installing Visual Studio from scratch.

---

<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:** [February 24, 2022, 3:30pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/10 "2022-02-24T15:30:31Z")

</div>

I think there was one that was just “latest build tools” (without a toolchain version). That may be what you need (I think the right tools still get used, but this is what hooks in wherever that is needed).

---

<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:** [February 24, 2022, 5:04pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/11 "2022-02-24T17:04:14Z")

</div>

I just checked with another coworker who had the same components installed as me. Seems like it’s local to my machine.

---

<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:** [February 25, 2022, 2:19am UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/12 "2022-02-25T02:19:59Z")

</div>

I completely re-installed Visual Studio 2022 Enterprise Edition.

 ![image](https://discourse.cmake.org/uploads/default/original/2X/5/50a9237410c643c50251309bd90d25011aa3612e.png)

I’m able to build a project that takes advantage of the resource compiler via the visual studio generator but not via the ninja generator.

As mentioned by @brad.king I end up finding RC.exe via the SDK:

```auto
PS C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64> .\rc.exe /?

Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation. All rights reserved.

```

However, that path is **NOT** getting added to the path in developer command prompts.

> ****
>
> ```auto
> **********************************************************************
> ** Visual Studio 2022 Developer PowerShell v17.1.0
> ** Copyright (c) 2021 Microsoft Corporation
> **********************************************************************
> PS C:\Program Files\Microsoft Visual Studio\2022\Enterprise> $env:path.split(";")
> C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\\Extensions\Microsoft\IntelliCode\CLI
> C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.31.31103\bin\HostX64\x64
> C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\VC\VCPackages
> C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow
> C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer
> C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\bin\Roslyn
> C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Team Tools\Performance Tools\x64
> C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Team Tools\Performance Tools
> C:\Program Files\Microsoft Visual Studio\2022\Enterprise\\MSBuild\Current\Bin\amd64
> C:\Windows\Microsoft.NET\Framework64\v4.0.30319
> C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\
> C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\
> C:\ProgramData\Oracle\Java\javapath
> C:\WINDOWS\system32
> C:\WINDOWS
> C:\WINDOWS\System32\Wbem
> C:\WINDOWS\System32\WindowsPowerShell\v1.0\
> C:\WINDOWS\System32\OpenSSH\
> 
> ```

---

<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, 7:08pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/13 "2022-03-02T19:08:31Z")

</div>

FWIW this looks like a Visual Studio [issue/bug](https://developercommunity.visualstudio.com/t/Resource-Compiler---rcexe-is-not-recogn/1676970?entry=myfeedback&ref=native&refTime=1646247976545&refUserId=f864723c-276b-6ad7-ba57-5fabfe0fe758). And isn’t caused by CMake. CMake can’t do anything about users not having properly setup their PATH.

---

<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 10, 2022, 9:35pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/14 "2022-03-10T21:35:20Z")

</div>

I found the cause of the bug!

TLDR: `Registry editing has been disabled by your administrator.`

[Link to the Visual Studio issue with full details](https://developercommunity.visualstudio.com/t/resource-compiler-rcexe-is-not-recognized-as-an-in/1676970)

---

<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 15, 2022, 5:02pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/15 "2022-03-15T17:02:09Z")

</div>

Looks like Microsoft [isn’t interested](https://developercommunity.visualstudio.com/t/resource-compiler-rcexe-is-not-recognized-as-an-in/1676970#T-N1692506) in fixing the issue from their side.

```auto
As a developer not having access to the registry is an uncommon scenario, it is suggested that the effected developers modify [VisualStudio Install Directory]\Common7\Tools\vsdevcmd\core\winsdk.bat.
By manually changing “set WindowsSdkDir=” to "set WindowsSdkDir=[path to windows sdk] IE: “C:\Program Files (x86)\Windows Kits\10” you should restore functionality for the command line. Note that depending on your project you may have to manually set additional variables in this file.

```

@brad.king / @ben.boeckel would a CMake side change be appropriate? I can make a PR for it.

---

<div class="post-metadata">

**Author:** ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)\
**Post date:** [March 15, 2022, 8:14pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/16 "2022-03-15T20:14:48Z")

</div>

Perhaps, but what do you propose CMake should do about 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 15, 2022, 9:19pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/17 "2022-03-15T21:19:15Z")

</div>

Perhaps something like this.

```auto
if (NOT EXISTS ${CMAKE_RC_COMPILER})
    message(FATAL_ERROR "Ensure SDK is installed AND registry editing is enabled!")
endif()

```

---

<div class="post-metadata">

**Author:** ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)\
**Post date:** [March 15, 2022, 9:26pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/18 "2022-03-15T21:26:17Z")

</div>

IIRC we do support `-DCMAKE_RC_COMPILER=rc`, and may not always convert that to an absolute path. In that case we’d assume `rc` is going to be in the `PATH`, but `if(EXISTS)` won’t work. Maybe we need to always convert `CMAKE_RC_COMPILER` to an absolute path as we do for other language compilers. If it fails to be found, then we can produce the nicer error.

---

<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 15, 2022, 9:41pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/19 "2022-03-15T21:41:41Z")

</div>

I’ll see if I can wrangle up a PR this weekend to address this

---

<div class="post-metadata">

**Author:** ![rvjr](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@rvjr](https://discourse.cmake.org/u/rvjr)\
**Post date:** [April 27, 2023, 7:29pm UTC](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089/20 "2023-04-27T19:29:24Z")

</div>

It’s not really related to the actual issue of the original post, but I ended up here with the same symptoms after a rather fresh installation of a new developer machine.

Running

```auto
reg query "HKLM\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0"

```

on the command line finally revealed that the Python3 installer inserted the `python/scripts` folder at the very beginning of the `PATH` environment variable, resulting in `reg.py` being executed instead of the `reg` command line tool when CMake was trying to query the registry for the path to the WindowsSDK… Moving the python folders further back in `PATH` fixed it immediately.

So maybe this helps other people ending up here to figure out what’s wrong more quickly.

[Next page](https://discourse.cmake.org/t/rc-rc-mt-cmake-mt-notfound/5089.md?page=2)
