title: box2d CreateFixture with b2FixtureDef gives pure virtual function call
body: <p>i have this code that gives me run time error in the line :</p>
  
  <pre><code>  body-&gt;CreateFixture(&amp;boxDef) 
  </code></pre>
  
  <p>im using cocos2d-x 2.1.5 with box2d 2.2.1 in windows </p>
  
  <pre><code>CCSprite *sprite = CCSprite::create(imageName.c_str());
      this-&gt;addChild(sprite,1);
  
      b2BodyDef bodyDef;
      bodyDef.type = isStatic?b2_staticBody:b2_dynamicBody;
      bodyDef.position.Set((position.x+sprite-&gt;getContentSize().width/2.0f)/PTM_RATIO,
                           (position.y+sprite-&gt;getContentSize().height/2.0f)/PTM_RATIO);
      bodyDef.angle = CC_DEGREES_TO_RADIANS(rotation);
      bodyDef.userData = sprite;
      b2Body *body = world-&gt;CreateBody(&amp;bodyDef);
  
      b2FixtureDef boxDef;
      if (isCircle)
      {
          b2CircleShape circle;
          circle.m_radius = sprite-&gt;getContentSize().width/2.0f/PTM_RATIO;
          boxDef.shape = &amp;circle;
      }
      else
      {
          b2PolygonShape box;
          box.SetAsBox(sprite-&gt;getContentSize().width/2.0f/PTM_RATIO, sprite-&gt;getContentSize().height/2.0f/PTM_RATIO);
          boxDef.shape = &amp;box;
      }
  
      if (isEnemy)
      {
          boxDef.userData = (void*)1;
          enemies-&gt;insert(body);
  
      }
  
      boxDef.density = 0.5f;
      body-&gt;CreateFixture(&amp;boxDef)  //&lt;-- HERE IS THE RUN TIME ERROR 
  </code></pre>
  
  <p>;</p>
  
  <p>when i debug the box2d code im getting to b2Fixture.cpp
  in the method :</p>
  
  <pre><code>void b2Fixture::Create(b2BlockAllocator* allocator, b2Body* body, const b2FixtureDef* def)
  </code></pre>
  
  <p>in the line :</p>
  
  <pre><code>m_shape = def-&gt;shape-&gt;Clone(allocator);
  </code></pre>
  
  <p>getting the runtime error :</p>
  
  <blockquote>
    <p>R6025 pure virtual function call</p>
  </blockquote>