'Undefined reference to `b2world` after installing Box2D with vcpkg

I would like to add Box2D to my project using vcpkg but it seems certain files aren't linking.

To do so I run .\vcpkg install box2d --triplet x64-windows and copy the values mentioned into my CMakeLists.txt.

find_package(box2d CONFIG REQUIRED)
target_link_libraries(main PRIVATE box2d::box2d)

After doing this I can include box2d/box2d.h.

#include "box2d/box2d.h"

b2Vec2 gravity(0.0f, -10.0f);
b2World world(gravity);

However this error is thrown.

undefined reference to `b2World::b2World(b2Vec2 const&)'

What else am I missing to get this working?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source