【发布时间】:2020-02-20 11:29:02
【问题描述】:
我正在尝试使用带有 MinGW 64 位套件的 Qt Creator 在 Windows 10 中构建 yaml-cpp。我正在使用 yaml-cpp-master 存储库,以防有人想知道。
当我尝试在 Qt Creator 中构建它时,我收到此错误:
C:\Program Files\CMake\share\cmake-3.16\Modules\CMakeMinGWFindMake.cmake:12: error: sh.exe was found in your PATH, here: C:/devkitPro/msys/bin/sh.exe For MinGW make to work correctly sh.exe must NOT be in your path. Run cmake from a shell that does not have sh.exe in your PATH. If you want to use a UNIX shell, then use MSYS Makefiles. CMakeLists.txt:3 (project)
我也在 Qt Creator 中使用 Windows Sandbox 尝试了相同的操作(模拟全新的 Windows 安装),但出现以下错误:
C:\Users\WDAGUtilityAccount\Documents\yaml-cpp-master\test\gtest-1.8.0\googletest\src\gtest-death-test.cc:637: error: 'AutoHandle' does not name a type; did you mean 'LocalHandle'?
AutoHandle write_handle_;
^~~~~~~~~~
LocalHandle
C:\Users\WDAGUtilityAccount\Documents\yaml-cpp-master\test\gtest-1.8.0\googletest\include\gtest\internal\gtest-port.h:1782: error: 'AutoHandle' does not name a type; did you mean 'mutable'?
AutoHandle thread_;
^~~~~~~~~~
mutable
C:\Users\WDAGUtilityAccount\Documents\yaml-cpp-master\test\gtest-1.8.0\googletest\src\gtest-death-test.cc:656: error: 'child_handle_' was not declared in this scope
const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() };
^~~~~~~~~~~~~
C:\Users\WDAGUtilityAccount\Documents\yaml-cpp-master\test\gtest-1.8.0\googletest\src\gtest-death-test.cc:670: error: 'write_handle_' was not declared in this scope
write_handle_.Reset();
^~~~~~~~~~~~~
C:\Users\WDAGUtilityAccount\Documents\yaml-cpp-master\test\gtest-1.8.0\googletest\src\gtest-death-test.cc:720: error: 'write_handle_' was not declared in this scope
write_handle_.Reset(write_handle);
^~~~~~~~~~~~~
C:\Users\WDAGUtilityAccount\Documents\yaml-cpp-master\test\gtest-1.8.0\googletest\src\gtest-death-test.cc:777: error: 'child_handle_' was not declared in this scope
child_handle_.Reset(process_info.hProcess);
^~~~~~~~~~~~~
在 Windows Sandbox 中完成时,这些错误太多了,我无法全部列出,其中大约有 33 个(其中一些是相同错误的重复项)。当我在 Ubuntu 或任何 GNU/Linux 发行版中构建 yaml-cpp 并且构建几乎没有任何问题时,它不会发生。
那么为什么这些错误只发生在 Windows 而不是 Ubuntu?
当我尝试使用 MSVC 2017 64 位套件在 Qt Creator 中构建 yaml-cpp 时,出现了这个错误:
C:\Temp\AME\yaml-cpp\test\gtest-1.8.0\googletest\include\gtest\internal\gtest-port.h:996: error: C2220: warning treated as error - no 'object' file generated
我真的很困惑发生了什么,为什么它只能在 GNU/Linux 发行版中运行,以及为什么它无法在 Windows 中构建?有没有办法在 Windows 中使用 Qt Creator 构建 yaml-cpp?
【问题讨论】:
-
Github 网站上有关于building 这个库在 Windows 上的说明。您是否按照这些说明进行操作?您每次尝试构建时使用的 CMake 命令是什么?
-
@squareskittles 没有关于如何使用 Qt Creator 构建的说明,只有关于使用 CMake 和 Visual Studio 的说明。这是否意味着它不能在 Windows 的 Qt Creator 中构建?或者是否有一些我必须更改的特定设置(例如 CMake 命令)?不过,它可以使用 Qt Creator 在 Ubuntu 中构建。
标签: c++ windows qt cmake yaml-cpp