erincatto / box2d

Box2D is a 2D physics engine for games
https://box2d.org
MIT License
8.36k stars 1.54k forks source link

Windows error LNK2019: unresolved external symbol #753

Closed eduardodoria closed 3 months ago

eduardodoria commented 1 year ago

I was getting this error when build in Windows:

error LNK2019: unresolved external symbol "public: class b2Joint * __cdecl b2World::CreateJoint(class b2JointDef const *)"

As you can see in this job: https://github.com/supernovaengine/supernova/actions/runs/5994348679/job/16255853451

I discovered the problem was in b2JointDef. After changed include order in box2d.h, putting joints before body, it worked. I don't know why.

#include "b2_distance_joint.h"
#include "b2_friction_joint.h"
#include "b2_gear_joint.h"
#include "b2_motor_joint.h"
#include "b2_mouse_joint.h"
#include "b2_prismatic_joint.h"
#include "b2_pulley_joint.h"
#include "b2_revolute_joint.h"
#include "b2_weld_joint.h"
#include "b2_wheel_joint.h"

#include "b2_body.h"
#include "b2_contact.h"
#include "b2_fixture.h"
#include "b2_time_step.h"
#include "b2_world.h"
#include "b2_world_callbacks.h"

Linux and Mac are ok in any order.

erincatto commented 3 months ago

Closing out v2 issues since it is no longer supported.