944,067 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 1441
  • C++ RSS
Jan 26th, 2007
0

Program Crashing PT2

Expand Post »
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
C++ Syntax (Toggle Plain Text)
  1. AL_INLINE(void, draw_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y),
  2. {
  3. ASSERT(bmp);
  4. ASSERT(sprite);
  5.  
  6. if (sprite->vtable->color_depth == 32) {
  7. bmp->vtable->draw_256_sprite(bmp, sprite, x, y);
  8. }
  9. else {
  10. ASSERT(bmp->vtable->color_depth == sprite->vtable->color_depth);
  11. bmp->vtable->draw_sprite(bmp, sprite, x, y);
  12. }
  13. }) //**Breakpoint Line 250 is here**
  14.  
  15.  
  16. AL_INLINE(void, draw_sprite_v_flip, (BITMAP *bmp, BITMAP *sprite, int x, int y),{
  17. ASSERT(bmp);
  18. ASSERT(sprite);
  19. ASSERT(bmp->vtable->color_depth == sprite->vtable->color_depth);
  20.  
  21. bmp->vtable->draw_sprite_v_flip(bmp, sprite, x, y);
  22. })
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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jd_1604 is offline Offline
22 posts
since Dec 2006
Jan 26th, 2007
0

Re: Program Crashing PT2

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.
Last edited by Ancient Dragon; Jan 26th, 2007 at 11:40 pm.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,954 posts
since Aug 2005
Jan 27th, 2007
0

Re: Program Crashing PT2

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jd_1604 is offline Offline
22 posts
since Dec 2006
Jan 27th, 2007
0

Re: Program Crashing PT2

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.
Team Colleague
Reputation Points: 2240
Solved Threads: 338
Vampirical Lurker
John A is offline Offline
5,055 posts
since Apr 2006
Jan 27th, 2007
1

Re: Program Crashing PT2

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 ....
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: connecting to camera-projector system with visual c++ 6
Next Thread in C++ Forum Timeline: What does ^ mean?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC