Cmake 无法在 Visual Studio 19 中编译简单的测试程序

问题描述

我克隆了一个我需要用于编码任务的库,并且可视化代码自动编译了它的 cmake 自动给了我这个,我已经查看了堆栈溢出并看到了与 cl.exe 类似的问题,但解决方案没有似乎是适合我的问题的任何东西,错误如下:

Severity    Code    Description Project File    Line    Suppression State
Error       CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.18/Modules/CMakeTestOBJCXXCompiler.cmake:62 (message):
  The Objective-C++ compiler

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

无法编译一个简单的测试程序。 它失败并显示以下输出

Change Dir: D:/puzzlenew/out/build/x64-Debug (default)/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe cmTC_0f8c7 && [1/2] Building OBJCXX object CMakeFiles\cmTC_0f8c7.dir\testOBJCXXCompiler.mm.o
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29337 for x64
copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9002 : ignoring unkNown option '-x'
cl : Command line warning D9024 : unrecognized source file type 'objective-c++',object file assumed
cl : Command line warning D9027 : source file 'objective-c++' ignored
cl : Command line warning D9024 : unrecognized source file type 'testOBJCXXCompiler.mm',object file assumed
cl : Command line warning D9027 : source file 'testOBJCXXCompiler.mm' ignored
cl : Command line warning D9021 : no action performed
[2/2] Linking OBJCXX executable cmTC_0f8c7.exe
Failed: cmTC_0f8c7.exe 
cmd.exe /C "cd . && C:\PROGRA~2\MIB055~1\2019\COMMUN~1\VC\Tools\MSVC\1428~1.293\bin\Hostx64\x64\cl.exe  /machine:x64 CMakeFiles\cmTC_0f8c7.dir\testOBJCXXCompiler.mm.o -o cmTC_0f8c7.exe   && cmd.exe /C "cd /D "D:\puzzlenew\out\build\x64-Debug (default)\CMakeFiles\CMakeTmp" && C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy Bypass -file C:/src/win32/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary "D:/puzzlenew/out/build/x64-Debug (default)/CMakeFiles/CMakeTmp/cmTC_0f8c7.exe" -installedDir C:/src/win32/vcpkg/installed/x64-windows/bin -Outvariable out""
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29337 for x64
copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9002 : ignoring unkNown option '/machine:x64'
cl : Command line warning D9024 : unrecognized source file type 'CMakeFiles\cmTC_0f8c7.dir\testOBJCXXCompiler.mm.o',object file assumed
Microsoft (R) Incremental Linker Version 14.28.29337.0
copyright (C) Microsoft Corporation.  All rights reserved.

/out:testOBJCXXCompiler.mm.exe 
/out:cmTC_0f8c7.exe 
CMakeFiles\cmTC_0f8c7.dir\testOBJCXXCompiler.mm.o 
LINK : Fatal error LNK1181: cannot open input file 'CMakeFiles\cmTC_0f8c7.dir\testOBJCXXCompiler.mm.o'
ninja: build stopped: subcommand Failed.



  

  CMake will not be able to correctly generate this project.        C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.18/Modules/CMakeTestOBJCXXCompiler.cmake 62  

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)