fmm(快速地图匹配)实践:Unknown toolset: vcunk的解决方案

项目场景:

fmm(快速地图匹配)实践

问题描述

报错:

bash 复制代码
LOCALAPPDATA=C:\Users\Administrator\AppData\Local
Found with vswhere Visual Studio Locator version 3.1.7+f39851e70f [query version 3.8.2091.34612]
###
### "Unknown toolset: vcunk"
###
### You can specify the toolset as the argument, i.e.:
###     .\build.bat msvc
###
### Toolsets supported by this script are: borland, como, gcc,
###     gcc-nocygwin, intel-win32, metrowerks, mingw,
###     vc11, vc12, vc14, vc141, vc142
###
### If you have Visual Studio 2017 installed you will need to either update
### the Visual Studio 2017 installer or run from VS 2017 Command Prompt
### as we where unable to detect your toolset installation.
###

原因分析:

根据 bootstrap.log 中的错误信息,问题的根本原因是 Boost 构建系统无法识别 Visual Studio 编译工具集(toolset)。具体错误是:Unknown toolset: vcunk。

问题分析:

未识别的工具集:vcunk 是一个未知的工具集,这可能是因为 Visual Studio 版本的工具集名称没有正确识别。Boost 的构建系统无法自动找到与 Visual Studio 版本对应的编译工具集。

Visual Studio 版本问题:如果安装的是 Visual Studio 2017 或更高版本,Boost 可能需要在 VS 2017 或更高版本的命令提示符中运行,而不是普通的命令行窗口。

解决方案:

  1. 指定正确的工具集
    Boost 构建系统尝试自动识别的编译器,但有时它不能成功。可以手动指定 Visual Studio 的工具集(msvc),如下所示:

打开 Visual Studio 开发者命令提示符(不是普通的命令行窗口)。可以通过开始菜单找到 "Developer Command Prompt for VS" 或 "x64 Native Tools Command Prompt for VS"。

在该命令提示符下,进入 Boost 源代码目录。

然后运行 bootstrap.bat,并指定 msvc 工具集:

bash 复制代码
bootstrap.bat msvc
  1. 安装并配置 Visual Studio
    确保已正确安装 Visual Studio,并包含了 C++ 工具集。

打开 Visual Studio 安装程序。

确保安装了 Desktop development with C++ 工作负载。

更新安装器,确保所有工具集(如 MSVC 编译器)都已正确安装。

  1. 手动指定工具集

如果知道自己安装的是哪个版本的 Visual Studio,可以手动指定工具集的版本,例如 msvc-14.2(对于 Visual Studio 2019)或 msvc-14.1(对于 Visual Studio 2017)。

运行 bootstrap.bat 时,指定工具集版本:

bash 复制代码
bootstrap.bat msvc-14.2
  1. 使用 Visual Studio 2017 命令提示符
    如果使用的是 Visual Studio 2017,并且构建工具无法自动识别,可以尝试使用 Visual Studio 2017 的命令提示符:

在 Visual Studio 2017 中,打开 Developer Command Prompt for VS 2017。

然后再次运行 bootstrap.bat。

  1. 检查环境变量

确保 vswhere 工具可以找到正确的 Visual Studio 安装路径。可以手动指定 Visual Studio 安装路径:

bash 复制代码
set VSINSTALLDIR="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
  1. 尝试使用预编译的 Boost
    如果手动编译 Boost 一直失败,另一种解决方案是直接使用预编译的 Boost 库,避免自己编译。可以通过包管理工具如 vcpkg 或 Conda 安装 Boost。

vcpkg 安装 Boost:

bash 复制代码
vcpkg install boost

Conda 安装 Boost:

bash 复制代码
conda install boost

总结:

使用 Visual Studio 开发者命令提示符,并在 bootstrap.bat 中指定工具集:msvc。

确保 Visual Studio 和 C++ 工具集 正确安装。

如果仍然遇到问题,可以考虑安装 vcpkg 或 Conda 预编译的 Boost 库。

相关推荐
在路上看风景9 小时前
19. 成员初始化列表和初始化对象
c++
zmzb01039 小时前
C++课后习题训练记录Day98
开发语言·c++
念风零壹10 小时前
C++ 内存避坑指南:如何用移动语义和智能指针解决“深拷贝”与“内存泄漏”
c++
孞㐑¥11 小时前
算法——BFS
开发语言·c++·经验分享·笔记·算法
AI袋鼠帝12 小时前
Claude4.5+Gemini3 接管电脑桌面,这回是真无敌了..
人工智能·windows·aigc
MZ_ZXD00112 小时前
springboot旅游信息管理系统-计算机毕业设计源码21675
java·c++·vue.js·spring boot·python·django·php
獨枭13 小时前
Windows 下安装与使用 Miniconda 完整指南
windows
A星空12313 小时前
一、Linux嵌入式的I2C驱动开发
linux·c++·驱动开发·i2c
凡人叶枫14 小时前
C++中智能指针详解(Linux实战版)| 彻底解决内存泄漏,新手也能吃透
java·linux·c语言·开发语言·c++·嵌入式开发
会叫的恐龙14 小时前
C++ 核心知识点汇总(第六日)(字符串)
c++·算法·字符串