cmake mingw-w64:尝试构建时出现奇怪的错误

cmake mingw-w64: strange error when trying to build

我已经安装了 MinGW-w64 并构建了一个简单的 Hello World 程序。但是第二次我运行cmake --build .出现了一个奇怪的错误。 当 Path 变量设置为 C:/MinGW/bin 时,一切都很好并且可以工作。但是当我将路径设置为 C:/msys64/mingw64/bin 时,会发生这种情况:

PS C:\repos\hellovs\build> cmake ../ -G Ninja
-- The CXX compiler identification is GNU 10.1.0
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/repos/hellovs/build
PS C:\repos\hellovs\build> cmake --build ./
[2/2] Linking CXX executable HelloVS.exe
PS C:\repos\hellovs\build> cmake --build ./
ninja: error: FindFirstFileExA(c/:/msys64/mingw64/include/c++/10.1.0): ╤шэЄръёшўхёър  ю°шсър т шьхэш Їрщыр, шьхэш яряъш шыш ьхЄъх Єюьр.

HelloVS.exe第一次编译正常编译命令是运行.

Apparanteley Ninja 尝试使用无效路径。知道如何解决这个问题吗?


似乎生成了无效的依赖项:

PS C:\repos\hellovs\build> ninja -t recompact
PS C:\repos\hellovs\build> ninja -t deps
CMakeFiles/HelloVS.dir/main.cpp.obj: #deps 136, deps mtime 6109023486207704 (VALID)
    ../main.cpp
    C/:/msys64/mingw64/include/c++/10.1.0/iostream
    C/:/msys64/mingw64/include/c++/10.1.0/x86_64-w64-mingw32/bits/c++config.h
    C/:/msys64/mingw64/include/c++/10.1.0/x86_64-w64-mingw32/bits/os_defines.h
    C/:/msys64/mingw64/include/c++/10.1.0/x86_64-w64-mingw32/bits/cpu_defines.h
    C/:/msys64/mingw64/include/c++/10.1.0/pstl/pstl_config.h
    C/:/msys64/mingw64/include/c++/10.1.0/ostream
...

这是一个 GCC 错误。

MSYS2 维护者决定不等待上游和 patched it

运行 pacman -Syuu 从 MSYS2 shell 更新你的包。