无法使用Qt Creator在Windows中构建yaml-cpp
Unable to build yaml-cpp in Windows using Qt Creator
我正在尝试使用Qt Creator和MinGW 64位工具包在Windows 10中构建yaml-cpp。我正在使用yaml-cpp主存储库,以防有人想知道。
当我试图在Qt Creator中构建它时,我得到了这个错误:
C:Program FilesCMakesharecmake-3.16ModulesCMakeMinGWFindMake.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:UsersWDAGUtilityAccountDocumentsyaml-cpp-mastertestgtest-1.8.0googletestsrcgtest-death-test.cc:637: error: 'AutoHandle' does not name a type; did you mean 'LocalHandle'?
AutoHandle write_handle_;
^~~~~~~~~~
LocalHandle
C:UsersWDAGUtilityAccountDocumentsyaml-cpp-mastertestgtest-1.8.0googletestincludegtestinternalgtest-port.h:1782: error: 'AutoHandle' does not name a type; did you mean 'mutable'?
AutoHandle thread_;
^~~~~~~~~~
mutable
C:UsersWDAGUtilityAccountDocumentsyaml-cpp-mastertestgtest-1.8.0googletestsrcgtest-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:UsersWDAGUtilityAccountDocumentsyaml-cpp-mastertestgtest-1.8.0googletestsrcgtest-death-test.cc:670: error: 'write_handle_' was not declared in this scope
write_handle_.Reset();
^~~~~~~~~~~~~
C:UsersWDAGUtilityAccountDocumentsyaml-cpp-mastertestgtest-1.8.0googletestsrcgtest-death-test.cc:720: error: 'write_handle_' was not declared in this scope
write_handle_.Reset(write_handle);
^~~~~~~~~~~~~
C:UsersWDAGUtilityAccountDocumentsyaml-cpp-mastertestgtest-1.8.0googletestsrcgtest-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:TempAMEyaml-cpptestgtest-1.8.0googletestincludegtestinternalgtest-port.h:996: error: C2220: warning treated as error - no 'object' file generated
我真的很困惑到底发生了什么,为什么它只在GNU/Linux发行版中工作,为什么它不能在Windows中构建?有没有任何方法可以使用QtCreator在Windows中构建yaml-cpp?
好的!我已经解决了问题!
我所需要做的就是从环境变量中的系统路径中删除C:/devkitPro/msys/bin/
,然后在YAML-CPP的Qt项目构建设置中禁用YAML_CPP_BUILD_TESTS,就成功了!
出于某种原因,GTest(谷歌测试框架(没有在MinGW中构建,这就是它出现错误的原因。
相关文章:
- 无法使用Qt Creator在Windows中构建yaml-cpp
- CMake WxWidgets项目成功地在Linux上构建,但没有在Windows上构建
- 使用 VS2015 在 Windows 10 上构建 Fortran .lib x64 位并将其链接到 C++
- 在Windows 10上使用Visual Studio 2019构建的Tesseract API c ++程序在Wind
- 如何在 Linux for Windows 上通过 MinGW 构建静态 ICU 的 Boost
- meson-build:wxWidgets 资源文件,用于 Windows 未构建
- 使用 MinGW 在 Windows 上构建 GLEW 时遇到问题
- 坚持编译QDoc以在Windows上构建qt5
- MSYS2 MinGW64 在 Windows 上构建 GMP/MPFR 作为静态库,并将它们链接到使用 CL 编译的
- 是否有可能构建面向Linux和Windows的.Net Core C++ / CLI应用程序?
- 使用 CMake 在 Windows 10 上构建 uWebSockets
- OpenCV cmake构建总是在Windows中抛出错误
- 如何在Windows上链接动态构建的cmake文件
- gRPC C++如何在Windows 10上构建
- 使用 Bazel (Windows) 构建 Tensorflow 的问题 => 使用 Tensorflow C++ API
- C Linux代码破坏Windows构建,因为缺少标头意味着功能不确定
- node-gip解析windows构建上的外部库符号
- 使用cygwin为windows构建静态库
- Linux和Windows构建的应用程序之间的OpenCV行为差异
- 在Linux上为Windows构建一个应用程序