CLion无法使用Visual Studio编译简单的测试程序

问题描述 投票:0回答:1
- The C compiler identification is MSVC 19.16.27035.0
-- The CXX compiler identification is MSVC 19.16.27035.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- broken
CMake Error at C:/Program Files/JetBrains/CLion 2019.1.3/bin/cmake/win/share/cmake-3.14/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/dbak/AppData/Local/Temp/cmake_check_environment/_build8400184188671408868/CMakeFiles/CMakeTmp

    Run Build Command(s):nmake /nologo cmTC_a9318\fast 
        "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe" -f CMakeFiles\cmTC_a9318.dir\build.make /nologo -L                  CMakeFiles\cmTC_a9318.dir\build
    Building C object CMakeFiles/cmTC_a9318.dir/testCCompiler.c.obj
        C:\PROGRA~2\MICROS~1\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\cl.exe @C:\Users\dbak\AppData\Local\Temp\nmD942.tmp
    testCCompiler.c
    Linking C executable cmTC_a9318.exe
        "C:\Program Files\JetBrains\CLion 2019.1.3\bin\cmake\win\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_a9318.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\10.0.17763.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\10.0.17763.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~1\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\cmTC_a9318.dir\objects1.rsp @C:\Users\dbak\AppData\Local\Temp\nmDB46.tmp
    LINK Pass 1: command "C:\PROGRA~2\MICROS~1\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\cmTC_a9318.dir\objects1.rsp /out:cmTC_a9318.exe /implib:cmTC_a9318.lib /pdb:C:\Users\dbak\AppData\Local\Temp\cmake_check_environment\_build8400184188671408868\CMakeFiles\CMakeTmp\cmTC_a9318.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_a9318.dir/intermediate.manifest CMakeFiles\cmTC_a9318.dir/manifest.res" failed (exit code 1120) with the following output:
    MSVCRTD.lib(utility_app.obj) : error LNK2019: unresolved external symbol __imp_RoInitialize referenced in function __scrt_initialize_winrt
    cmTC_a9318.exe : fatal error LNK1120: 1 unresolved externals
    NMAKE : fatal error U1077: '"C:\Program Files\JetBrains\CLion 2019.1.3\bin\cmake\win\bin\cmake.exe"' : return code '0xffffffff'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
    Stop.




  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Configuring incomplete, errors occurred!
See also "C:/Users/dbak/AppData/Local/Temp/cmake_check_environment/_build8400184188671408868/CMakeFiles/CMakeOutput.log".
See also "C:/Users/dbak/AppData/Local/Temp/cmake_check_environment/_build8400184188671408868/CMakeFiles/CMakeError.log".

Error code: 1

[尝试在捆绑的cmake中使用amd64,uwp。

我不确定该如何解决。

c++ cmake visual-studio-2017 clion
1个回答
0
投票

此问题在CLion论坛here上似乎有一种可能的解决方法。本质上,您需要让CMake知道您的平台是WindowsStore。您可以通过添加以下标志,通过CLion GUI(文件>设置>构建,执行,部署> CMake

© www.soinside.com 2019 - 2024. All rights reserved.