使用 vcpkg 安装 box2d

Installing box2d with vcpkg

本文关键字:box2d 安装 vcpkg 使用      更新时间:2023-10-16

当我尝试在vscode中#include <box2d/box2d.h>时。我收到此错误:

fatal error: box2d/box2d.h: No such file or directory
#include <box2d/box2d.h>

甚至 vscode 在我包含它
时自动完成库 我的 vcpkg 列表./vcpkg list
box2d:x64-linux 2019-12-31 An open source C++ engine for simulating rigid b...
我还./vcpkg integrate install输出了
集成步骤:

Applied user-wide integration for this vcpkg root.
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=/home/mohamed/packman/scripts/buildsystems/vcpkg.cmake"

我在安装库时是否缺少一个步骤

安装软件包vcpkg install box2d时,您应该有 CMake 目标指令。例如,我有这个:

The package box2d:x64-linux provides CMake targets:
find_package(unofficial-box2d CONFIG REQUIRED)
target_link_libraries(main PRIVATE unofficial::box2d::box2d)

然后,您需要使用这些说明更新CMakeLists.txt,并最终将其替换为目标的名称main