vcpkg 安装 VTK 失败 error: building vtk:x64-windows failed with: BUILD_FAILED

vcpkg install vtk:x64-windows

报错:

CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: F:/Software/CMake/bin/cmake.exe --build . --config Debug --target install -- -v -j5
    Working Directory: F:/Library/vcpkg/buildtrees/vtk/x64-windows-dbg
    See logs for more information:
      F:\Library\vcpkg\buildtrees\vtk\install-x64-windows-dbg-out.log

Call Stack (most recent call first):
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process)
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build)
  ports/vtk/portfile.cmake:261 (vcpkg_cmake_install)
  scripts/ports.cmake:170 (include)


error: building vtk:x64-windows failed with: BUILD_FAILED
Elapsed time to handle vtk:x64-windows: 7.8 min
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+vtk
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[vtk]+Build+error+on+x64-windows&body=Copy+issue+body+from+F%3A%2FLibrary%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md

在这里插入图片描述
根据它的提示我们打开install-x64-windows-dbg-out.log,可以看到error是这样的

f:\library\vcpkg\buildtrees\vtk\src\67209150f8-20b191a384.clean\common\datamodel\vtkUniformHyperTreeGrid.h(218): error C2039: “min”: 不是“std”的成员
F:\Library\vcpkg\buildtrees\vtk\x64-windows-dbg\Utilities\KWSys\vtksys/SystemTools.hxx(32): note: 参见“std”的声明
f:\library\vcpkg\buildtrees\vtk\src\67209150f8-20b191a384.clean\common\datamodel\vtkUniformHyperTreeGrid.h(218): error C2039: “max”: 不是“std”的成员
F:\Library\vcpkg\buildtrees\vtk\x64-windows-dbg\Utilities\KWSys\vtksys/SystemTools.hxx(32): note: 参见“std”的声明
f:\library\vcpkg\buildtrees\vtk\src\67209150f8-20b191a384.clean\common\datamodel\vtkUniformHyperTreeGrid.h(218): error C3861: “max”: 找不到标识符
f:\library\vcpkg\buildtrees\vtk\src\67209150f8-20b191a384.clean\common\datamodel\vtkUniformHyperTreeGrid.h(218): error C3861: “min”: 找不到标识符

在这里插入图片描述
因此我们需要为这些有std::min()/std::max()的文件添加#include <algorithm>

使用vscode用正则表达式搜索(std::min|std::max),给所有文件都加上头文件#include <algorithm>
在这里插入图片描述

重新安装

vcpkg install vtk:x64-windows --editable

注意需要加上--editable,否则默认检测到修改后会改回去

-- Cleaning sources at F:/Library/vcpkg/buildtrees/vtk/src/67209150f8-20b191a384.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source F:/Library/vcpkg/downloads/Kitware-VTK-66143ef041b980a51e41ee470d053e67209150f8.tar.gz
  • 9
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值