gpt4 book ai didi

c++ - 无法使用Qt Creator在Windows中构建yaml-cpp

转载 作者:行者123 更新时间:2023-12-02 10:35:55 28 4
gpt4 key购买 nike

我正在尝试使用Qt Creator和MinGW 64位套件在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)

我还使用Windows Sandbox在Qt Creator中尝试了相同的操作(以模拟全新的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沙箱中完成这些错误时,我无法一一列出所有这些错误,其中大约有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中构建感到困惑。有什么方法可以使用Qt Creator在Windows中构建yaml-cpp吗?

最佳答案

好的!我已经解决了问题!

我需要做的就是从环境变量的System PATH中删除C:/devkitPro/msys/bin/,然后在yaml-cpp的Qt项目构 build 置中禁用 YAML_CPP_BUILD_TESTS ,它起作用了!

出于某种原因,GTest(Google测试框架)未在MinGW中构建,这就是它存在该错误的原因。

关于c++ - 无法使用Qt Creator在Windows中构建yaml-cpp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60318935/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com