CreateFixture problem.

Hello every1,
I have a little problem. When I call function CreateFixture the programm crashes. Here is src:

Code:
int main() {
   init();
   b2Vec2 gravity(0.0f,-10.0f);
   bool doSleep=true;
   
   b2World world(gravity, doSleep);
   
   b2BodyDef groundBodyDef;
   groundBodyDef.position.Set(0.0f, -10.0f);
   
   b2Body * groundBody = world.CreateBody(&groundBodyDef);
   
   b2PolygonShape groundBox;
   groundBox.SetAsBox(50.0f, 10.0f);
   
   groundBody->CreateFixture(&groundBox, 0.0f);
   
   textprintf_ex(screen,font,40,140,0xff0000,-1,"1");
   
   b2BodyDef bodyDef;
    bodyDef.type = b2_dynamicBody;
    bodyDef.position.Set(0.0f, 4.0f);
    b2Body* body = world.CreateBody(&bodyDef);
   
      textprintf_ex(screen,font,40,150,0xff0000,-1,"2");
   
    b2PolygonShape dynamicBox;
    dynamicBox.SetAsBox(1.0f, 1.0f);

    b2FixtureDef fixtureDef;
    fixtureDef.shape = &dynamicBox;
    fixtureDef.density = 1.0f;
    fixtureDef.friction = 0.3f;
   
   textprintf_ex(screen,font,40,160,0xff0000,-1,"3");   
   
    body->CreateFixture(&fixtureDef);
   
    float32 timeStep = 1.0f / 60.0f;
   
   textprintf_ex(screen,font,40,170,0xff0000,-1,"4"); 
     
    int32 velocityIterations = 6;
    int32 positionIterations = 2;
   
   

   while (!key[KEY_ESC])
    {
       world.Step(timeStep, velocityIterations, positionIterations);
        b2Vec2 position = body->GetPosition();
        float32 angle = body->GetAngle();
        clear_to_color(screen,0x0);
        textprintf_ex(screen,font,40,140,0xff0000,-1,"%f %f %f\n",position.x, position.y, angle);
   }


It prints 1,2,3 and then... crash.
I use c++ with allegro. Maybe its easy to solve, but im new to Box2D, so please be patient.
Thanx for all replies,
kitty.
nobody?
maybe another question... can sbd cmake files of 2.2.0 for mingw? I downloaded files, didnt maked it, so i think it could be this.
Kitty
Relax, these forums may move a little slower than you're expecting.
That code runs ok for me. Maybe the text you are printing out is not being flushed to the screen immediately.
Ideally you should step through the code with a debugger to find out exactly where it hits the problem. You should also be able to get something useful from the stack trace after the crash happens.
Hmm, i think it could be .a files becouse i downloaded it, in case i couldnt build it. Can you please compile it for mingw and send, id be pleased.
Kitty
Can sbd do that for me? I really need it.

Original thread: https://box2d.org/forum/viewtopic.php?t=7592