3

I'm trying to compile a C++ program with clang using cmake, but I get the following error:

> CMake Error at C:/Program Files/CMake/share/cmake-3.12/Modules/CMakeDetermineRCCompiler.cmake:20 (message):
  Could not find compiler set in environment variable RC:

>  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\Hostx64\x64.
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.12/Modules/Platform/Windows-MSVC.cmake:380 (enable_language)
  C:/Program Files/CMake/share/cmake-3.12/Modules/Platform/Windows-Clang.cmake:16 (__windows_compiler_msvc)
  C:/Program Files/CMake/share/cmake-3.12/Modules/Platform/Windows-Clang-C.cmake:2 (__windows_compiler_clang)
  C:/Program Files/CMake/share/cmake-3.12/Modules/CMakeCInformation.cmake:48 (include)
  CMakeLists.txt:18 (project)

What could be the problem? Searched all the internet, but didn't find an answer. Thanks in advance!

molbdnilo
  • 64,751
  • 3
  • 43
  • 82
Tóth Attila
  • 149
  • 1
  • 1
  • 10
  • 1
    The first is mysterious; `RC` appears to not be set, but the script shouldn't get to that point if it isn't. The second seems to be missing part of the message, after `Hostx64\x64.`. What command are you executing? – molbdnilo Nov 06 '18 at 12:03
  • Do you have `*.rc` sources file(s) and forget to add `LANGUAGES RC` to `project()` call? – zaufi Nov 07 '18 at 21:57

1 Answers1

0

I ran into this exact error message and ended up resolving this by running my cmake command from a developer command prompt. For visual studio 2017, this is done by running Common7\Tools\VsDevCmd.bat. via standard command prompt. This is usually found in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community (This location depends on your VS install).