CMake错误:无法编译简单测试程序

2024-05-15 07:35:02 发布

您现在位置:Python中文网/ 问答频道 /正文

在将环境更改为Python2.7之后,我在运行build_win.cmd后出现了这个错误

CMake Error at C:/Users/deVam/Anaconda3/envs/pythonenv/Library/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

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

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/caffe/caffe/build/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/Users/deVam/Anaconda3/envs/pythonenv/Library/bin/ninja.exe cmTC_b499f && [1/2] Building C object CMakeFiles\cmTC_b499f.dir\testCCompiler.c.obj
    [2/2] Linking C executable cmTC_b499f.exe
    FAILED: cmTC_b499f.exe
    cmd.exe /C "cd . && C:\Users\deVam\Anaconda3\envs\pythonenv\Library\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_b499f.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests  -- C:\PROGRA~2\MICROS~4\2019\COMMUN~1\VC\Tools\MSVC\1426~1.288\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_b499f.dir\testCCompiler.c.obj  /out:cmTC_b499f.exe /implib:cmTC_b499f.lib /pdb:cmTC_b499f.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 && cd ."
    RC Pass 1: command "rc /fo CMakeFiles\cmTC_b499f.dir/manifest.res CMakeFiles\cmTC_b499f.dir/manifest.rc" failed (exit code 0) with the following output:
    The system cannot find the file specified
    ninja: build stopped: subcommand failed.




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

Tags: buildbinlibdirlibraryexeusersrc