C++ VSCode CMake VCPKG:未启用清单

R3t*_*R3t 5 c++ manifest cmake visual-studio-code vcpkg

我正在尝试构建Supertux-C++-Project,本视频所示。

我安装了 C++ 和 CMake 的 VS Code 扩展,并且使用 GCC 编译器。我克隆了 VCPKG-Repository 并执行了bootstrap-vcpkg.bat. 之后我跑了./vcpkg integrate install并收到消息:

为此 vcpkg 根应用了用户范围的集成。

看起来.vscode\settings.json像:

{
    "cmake.configureSettings": {
        "CMAKE_TOOLCHAIN_FILE": "D:/_programming/_repos/vcpkg/scripts/buildsystems/vcpkg.cmake",
        "VCPKG_BUILD": "ON",
    }
}
Run Code Online (Sandbox Code Playgroud)

然后我vcpkg.json在 Supertux-Project-Folder 中创建了一个文件并插入了必要的库:

{
    "name": "supertux-example",
    "version": "0.0.1",
    "dependencies": [
        "sdl2",
        "sdl2-image",
        "openal-soft",
        "curl",
        "libogg",
        "libvorbis",
        "freetype",
        "glew",
        "boost-date-time",
        "boost-filesystem",
        "boost-format",
        "boost-locale",
        "boost-system"
    ]
}
Run Code Online (Sandbox Code Playgroud)

现在我尝试使用以下命令访问所有这些库:D:\_programming\_repos\vcpkg\vcpkg.exe install --triplet "x64-windows" --binarycaching但收到以下错误消息:

Warning: manifest-root detected at D:/_programming/cpp/supertux, but manifests are not enabled.
If you wish to use manifest mode, you may do one of the following:
    * Add the `manifests` feature flag to the comma-separated environment
      variable `VCPKG_FEATURE_FLAGS`.
    * Add the `manifests` feature flag to the `--feature-flags` option.
    * Pass your manifest directory to the `--x-manifest-root` option.
If you wish to silence this error and use classic mode, you can:
    * Add the `-manifests` feature flag to `VCPKG_FEATURE_FLAGS`.
    * Add the `-manifests` feature flag to `--feature-flags`.
Error: 'install' requires at least 1 arguments, but 0 were provided
Run Code Online (Sandbox Code Playgroud)

有人可以告诉我如何激活清单模式并解释这个错误的具体原因吗?(我在 C++ 项目中使用外部库的经验不多。)

Dea*_*son 4

清单是vcpkg. 它允许您(通过文件)指定vcpkg.json您的依赖项。旧的方法意味着实际上没有办法vcpkg通过查看项目文件夹来自动了解您的依赖项。您基本上必须手动安装它们。

默认情况下未启用清单模式。可以通过定义环境变量来启用它VCPKG_FEATURE_FLAGS=manifests。也可以直接调用 vcpkg: 来启用D:\_programming\_repos\vcpkg\vcpkg.exe install --feature-flags=manifests,binarycaching --triplet "x64-windows"