| | |
Program Crashing PT2
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Dec 2006
Posts: 22
Reputation:
Solved Threads: 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
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?
The point is triggered on line 250
C++ Syntax (Toggle Plain Text)
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); })
What can I do now?
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.
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
Join Date: Dec 2006
Posts: 22
Reputation:
Solved Threads: 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.
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.
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.
"Technological progress is like an axe in the hands of a pathological criminal."
All my posts may be freely redistributed under the terms of the MIT license.
All my posts may be freely redistributed under the terms of the MIT license.
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 ....
> 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 ....
![]() |
Similar Threads
- Program Crashing (C)
- Program keeps crashing... (C++)
- Program Crashing, security related? (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: connecting to camera-projector system with visual c++ 6
- Next Thread: What does ^ mean?
Views: 1254 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll dynamic encryption error file forms fstream function functions game givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linker linux loop looping loops map math matrix memory microsoft newbie news number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort stream string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






