Error debug in box2d createfixture Error:R6025 pure Virtual function call solution

This error occurs because the ShapeDef is on the shape. Do not create it in a field at the same level as the ShapeDef when you create the Shape. For example, this throws an exception:

b2FixtureDef boxDef;

    if (isCircle)
    {
        b2CircleShape circle;
        circle.m_radius = sprite->getContentSize().width/2.0f/PTM_RATIO;
        boxDef.shape = &circle;
    }
    else
    {
        b2PolygonShape box;
        box.SetAsBox(sprite->getContentSize().width/2.0f/PTM_RATIO, sprite->getContentSize().height/2.0f/PTM_RATIO);
        boxDef.shape = &box;
    }

can be written to avoid exceptions:

    b2CircleShape circle;
    b2PolygonShape box;
    if (isCircle)
    {
        circle.m_radius = sprite->getContentSize().width/2.0f/PTM_RATIO;
        boxDef.shape = &circle;
    }
    else
    {
        box.SetAsBox(sprite->getContentSize().width/2.0f/PTM_RATIO, sprite->getContentSize().height/2.0f/PTM_RATIO);
        boxDef.shape = &box;
    }

Read More: