c++ - 使用 vcpkg 安装 box2d
问题描述
当我尝试#include <box2d/box2d.h>
在 vscode 中时。我收到了这个错误:
fatal error: box2d/box2d.h: No such file or directory
#include <box2d/box2d.h>
甚至当我将它包含在
我的 vcpkg 列表中时,vscode 也会自动完成库,./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
为您的目标名称。
推荐阅读
- javascript - 纹理是将音频数据传输到 GLSL 的唯一方法吗?
- erlang - 为什么我在运行 eunit 测试时会出错?
- ruby-on-rails - Rails 4:删除目录后如何重新创建 Postgres 数据库
- ubuntu - 如何让 orca 在 ubuntu 上的 Firefox 中阅读网页
- c++ - 为什么可以在析构函数中删除未初始化的指针,但不能在 main 中删除?
- powershell - 保持变量私有,但仍然在函数中使用它
- asp.net - 如何将 ID 参数从视图传递到控制器?
- sql - 识别为实际记录创建多次的冲销记录
- javascript - 只在一定时间后应用悬停效果,但如果鼠标退出也会移除效果
- javascript - 无法从控制器中的输入访问 ng-model