使用vcpkg安装指定版本包时遇--manifest参数错误求助
解决vcpkg安装时"unexpected switch: --manifest"错误
原因
你使用的vcpkg版本过旧,不支持通过vcpkg.json管理依赖的manifest模式。旧版本遇到目录中的vcpkg.json文件时,会错误地尝试传递它无法识别的--manifest参数,从而触发该报错。
解决步骤
1. 升级vcpkg到最新版本
进入你的vcpkg根目录,执行以下命令完成更新:
git pull .\bootstrap-vcpkg.bat # Windows环境 # Linux/macOS环境执行:./bootstrap-vcpkg.sh
更新完成后,重新运行安装命令:
vcpkg install --triplet x64-windows
2. 显式启用manifest模式(可选)
如果升级后仍存在问题,可手动指定以manifest模式运行命令:
vcpkg install --triplet x64-windows --manifest-mode
3. 临时替代方案(不推荐)
若暂时无法升级vcpkg,可删除当前目录下的vcpkg.json,改用命令行直接指定包和版本进行安装:
vcpkg install boost:1.83.0#x64-windows hiredis:1.0.0#x64-windows nlohmann-json:3.11.3#x64-windows spdlog:1.14.1#x64-windows fmt:10.2.1#x64-windows libpq:16.2#x64-windows librdkafka:2.3.0#x64-windows curl:8.7.1#x64-windows
注意:这种方式需要手动维护所有依赖版本,无法利用builtin-baseline的依赖锁定能力,仅作为临时应急方案使用。
内容的提问来源于stack exchange,提问作者soykot2910
相关产品推荐
相关产品推荐

