0

O.K. Ive compiled my program for debugging. I really don't know where to start looking. My program consists of two blocks of source code (Robotmoves.cpp and Character.cpp) and one header file (Character.h) Once I have compiled and attempted to run the program the error tells me my Robotmoves.EXE had triggered a breakpoint. This brakpoint is found in draw.inl (which I presume is part of the allegro library)
The point is triggered on line 250

AL_INLINE(void, draw_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y),
{
   ASSERT(bmp);
   ASSERT(sprite);

   if (sprite->vtable->color_depth == 32) {
      bmp->vtable->draw_256_sprite(bmp, sprite, x, y);
   }
   else {
      ASSERT(bmp->vtable->color_depth == sprite->vtable->color_depth);
      bmp->vtable->draw_sprite(bmp, sprite, x, y);
   }
}) //**Breakpoint Line 250 is here**


AL_INLINE(void, draw_sprite_v_flip, (BITMAP *bmp, BITMAP *sprite, int x, int y),{
   ASSERT(bmp);
   ASSERT(sprite);
   ASSERT(bmp->vtable->color_depth == sprite->vtable->color_depth);

   bmp->vtable->draw_sprite_v_flip(bmp, sprite, x, y);
})

I really don't know, unless I posted my entire code, where else I should be looking. I also tried compiling with Dev C++ but got the same thing. Animation frame comes up, arrow key is pressed, 'Allegro had encountered a problem and needs to close. We are sorry......'
What can I do now?

4
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by Salem
0

put a break point at the beginning of the function and step through the program one line at a time to see where it breaks. Also check the validity of all pointers -- If a pointer has a value something like "hchchchchc" that is what the compiler initializes them to when compiled for debug -- and is an uninitialized or bad pointer.

And please stop creating a new thread every time you have a new question about the same program. Just post your question(s) to the existing thread, that will bump it to the top of the list.

0

put a break point at the beginning of the function and step through the program one line at a time to see where it breaks. Also check the validity of all pointers -- If a pointer has a value something like "hchchchchc" that is what the compiler initializes them to when compiled for debug -- and is an uninitialized or bad pointer.

And please stop creating a new thread every time you have a new question about the same program. Just post your question(s) to the existing thread, that will bump it to the top of the list.

Sorry But I must be really thick in the head today. I'm having trouble understanding by what you mean when you say to create a breakpoint at the start of the function. All my pointers seem to be correct. Forgive my ignorance

0

He means creating a breakpoint in the debugger - you do have one don't you? They help immensly in tracking down bugs and memory leaks.

If you don't have a debugger, I recommend you liberally sprinkle print statements so you can see the values of not only what the pointers contain, but also the memory addresses of them before the program crashes.

1

From your other post
> Assert failed at line 250 of c:\code\allegro\include\allegro\inline/draw.inl
Open draw.inl in your editor.
Goto line 250.
Read the line which will be something like say ASSERT(x >= 0);

The code expects that expression to be true.
In your program, that expression was false.

Now ask yourself how the condition comes to be false, and how can I make it be true.
Perhaps by initialising variables, or allocating resourses, or ....

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.