Linking error - Visual Studio Build Tools

0

I'm getting linking errors when CMake tries to run a basic compiler check in CLion, using Visual Studio Build tools as the enviroment.

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 CLion, LLVM, Visual Studio Build tools, as well as different versions of CMake, but nothing has been able to fix the errors.

Below is my toolchain setup in CLion.

1

Does anyone know what the issue could be?

c++
cmake
visual-studio-2019
clion
build-tools
asked on Stack Overflow Feb 9, 2021 by Zack • edited Feb 9, 2021 by Alan Birtles

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0