CLion 2020.3 - Visual Studio Build Tools link error Follow
Answered
I have recently encountered an issue where I get loads of errors when CMake does a basic compiler check.
The errors are as follows:
"C:\Program Files\JetBrains\CLion 2020.3.2\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_C_COMPILER=C:/Program Files/LLVM/bin/clang-cl.exe" "-DCMAKE_CXX_COMPILER=C:/Program Files/LLVM/bin/clang-cl.exe" -DCMAKE_C_FLAGS=-m64 -DCMAKE_CXX_FLAGS=-m64 -G "CodeBlocks - NMake Makefiles" D:\ASGE-Repositories\asgenetgame-team-11
-- The CXX compiler identification is Clang 11.0.0 with MSVC-like command-line
-- Check for working CXX compiler: C:/Program Files/LLVM/bin/clang-cl.exe
-- Check for working CXX compiler: C:/Program Files/LLVM/bin/clang-cl.exe - broken
CMake Error at C:/Program Files/JetBrains/CLion 2020.3.2/bin/cmake/win/share/cmake-3.17/Modules/CMakeTestCXXCompiler.cmake:53 (message):
The C++ compiler
"C:/Program Files/LLVM/bin/clang-cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/ASGE-Repositories/asgenetgame-team-11/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):nmake /nologo cmTC_8bbb0\fast && "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64\nmake.exe" -f CMakeFiles\cmTC_8bbb0.dir\build.make /nologo -L CMakeFiles\cmTC_8bbb0.dir\build
Building CXX object CMakeFiles/cmTC_8bbb0.dir/testCXXCompiler.cxx.obj
C:\PROGRA~1\LLVM\bin\clang-cl.exe @C:\Users\zackj\AppData\Local\Temp\nmFE32.tmp
Linking CXX executable cmTC_8bbb0.exe
"C:\Program Files\JetBrains\CLion 2020.3.2\bin\cmake\win\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_8bbb0.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests -- C:\PROGRA~1\LLVM\bin\lld-link.exe /nologo @CMakeFiles\cmTC_8bbb0.dir\objects1.rsp @C:\Users\zackj\AppData\Local\Temp\nmFE62.tmp
LINK Pass 1: command "C:\PROGRA~1\LLVM\bin\lld-link.exe /nologo @CMakeFiles\cmTC_8bbb0.dir\objects1.rsp /out:cmTC_8bbb0.exe /implib:cmTC_8bbb0.lib /pdb:D:\ASGE-Repositories\asgenetgame-team-11\cmake-build-debug\CMakeFiles\CMakeTmp\cmTC_8bbb0.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 /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_8bbb0.dir/intermediate.manifest CMakeFiles\cmTC_8bbb0.dir/manifest.res" failed (exit code 1) with the following output:
lld-link: error: could not open 'kernel32.lib': no such file or directory
lld-link: error: could not open 'user32.lib': no such file or directory
lld-link: error: could not open 'gdi32.lib': no such file or directory
lld-link: error: could not open 'winspool.lib': no such file or directory
lld-link: error: could not open 'shell32.lib': no such file or directory
lld-link: error: could not open 'ole32.lib': no such file or directory
lld-link: error: could not open 'oleaut32.lib': no such file or directory
lld-link: error: could not open 'uuid.lib': no such file or directory
lld-link: error: could not open 'comdlg32.lib': no such file or directory
lld-link: error: could not open 'advapi32.lib': no such file or directory
NMAKE : fatal error U1077: '"C:\Program Files\JetBrains\CLion 2020.3.2\bin\cmake\win\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
I have tried reinstalling both CLion & Visual studio build tools, as well as installing different versions of both, but neither has done anything to change the error messages.
Below is my toolchain setup as well

Please sign in to leave a comment.
Hello!
Are you able to build this CMake project with this compiler outside CLion, for example, in Command Prompt?
I fell into a similar situation and was able to fix it by installing another Windows SDK in "Visual Studio Installer".
I just unselected the currently checked "Windows SDK 10" and selected the latest "Windows 11 SDK" and everything goes fine as before.
However, I don't know the reasons behind these. If my memory serves, I just updated Visual Studio via the Visual Studio Installer days before.
I also answered a question on Stack Overflow. https://stackoverflow.com/a/72714420/18472514
See also Linker Tools Error LNK1104 - Microsoft Docs. https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk1104?view=msvc-170