Configuring Slicer fails - C compiler not found

I am rebuilding everything due to the change of version to 5, and on one of the machines I use (after building successfully on another) I’m getting this error.

c:\d\S5R>"c:\Program Files\CMake\bin\cmake.exe" c:\d\Slicer -G "Visual Studio 17 2022" -DQt5_DIR:PATH=c:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5 -DSlicer_USE_SimpleITK:BOOL=OFF
-- Setting C++ standard
-- Setting C++ standard - C++14
-- 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:51 (project):
  No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:51 (project):
  No CMAKE_CXX_COMPILER could be found.

What I did:

  • Install VS 2022 (Community) from scratch
    • Made sure it installs Windows SDK (10.0.19041.0) (searching online, it seemed to be the problem for others)
  • Started VS 2022 (I remembered from earlier versions that setup is fully finalized when starting)
  • Checked the files MSBuild.exe and cl.exe, they seem to be in the right place (exactly the same as on the machine it built well)
  • Did a Repair on VS 2022
  • Restarted the machine a few times

Does anyone has an idea what it may be? Thanks a lot!

In CMakeError.log I see this
LINK : fatal error LNK1104: cannot open file 'ucrtd.lib'
Could it be that the Windows SDK I have is not compatible with the Windows version?

It turns out I manually had to install the latest Windows SDK (downloaded from here) and then configure got past this error.

Sorry for the noise; maybe for someone this topic will solve the same issue.

3 Likes

I just register to say thank you :slight_smile:
You saved me after 2 days wasting of time

2 Likes