Hello,
I have been working on a game for a few days now but keep coming across problems where it says unhandled exception.
I have come to the realization they are all caused by the same problem.
-"allegro-5.0.7-monolith-md-debug.pdb not loaded"
-"allegro-5.0.7-monolith-md-debug.pdb contains the debug information required to find the source for the module allegro-5.0.7-monolit-md-debug.dll"
I have included an image of the error it's throwing.
Any help with this issue would be great because i just have no idea how to go about fixing it.:'(
The program falls apart when this code is called for the second time;
I have been working on a game for a few days now but keep coming across problems where it says unhandled exception.
I have come to the realization they are all caused by the same problem.
Use your debugger and see what line it is crashing on. Your image says line 70. Show us your code with <code>code goes here...</code> tags.
-"allegro-5.0.7-monolith-md-debug.pdb not loaded"
-"allegro-5.0.7-monolith-md-debug.pdb contains the debug information required to find the source for the module allegro-5.0.7-monolit-md-debug.dll"
All it means is there is no associated pdb debugging file to go along with the dll. A pdb file contains debugging symbols so you can tell where it is crashing.
The program falls apart when this code is called for the second time;
If it is crashing on al_get_next_event, then allegro hasn't been initialized, or the event queue is invalid, or the address of the event is invalid. I don't think that is really what is wrong though.
Thanks for the reply,
The program crashes on the first line of the code I've already shown you.
The code is for a class I've called AllegroStart.
What i want the class to do is to handle the initialization of allegro as well as event handling, the problem i'm having has started occurring since trying to include a timer in the program.
Here is the entire Class;
Header File-
.cpp file
I haven't looked super closely but you may be making a copy of your AllegroStart object. If that happens, the destructor will be called which will shutdown allegro which will make any further calls to allegro functions fail.
Show the code where you use your AllegroStart object.
AllegroStart is only used in my main.cpp source file, here is the code from that file (i know, it's messy, all a work it progress!!)
Don't call destructors directly. delete takes care of calling the destructor for you.
I don't have time to look over the rest of it now, but I will look again later.
That's great, thank you for the help so far!
Things are bound to go wrong because you it looks like you are loading assets before allegro is initialized. You create Hero and Monster objects before calling bool init_ok = alleg->initialise_allegro();.
{ alleg = new AllegroStart(); Hero1 = new Hero(5 , 100 , 200 , "assets/PlaceHolderDude.bmp" , 200 , 2 , Arena1); Arena1 = new Arena(); Monster1 = new Monster(100, 200, "assets/Monster.bmp", 100, 2, Arena1); Monster2 = new Monster(100, 200, "assets/Monster.bmp", 100, 2, Arena1); Monster3 = new Monster(100, 200, "assets/Monster.bmp", 100, 2, Arena1); Monster4 = new Monster(100, 200, "assets/Monster.bmp", 100, 2, Arena1);
You need to insert your initialization code here :
Hey,
I've made the change you suggested, it explains why i was having trouble with some other parts of the program previously, however, it hasn't fixed the problem with 'got_event'.
I found very difficult to go through your codeflow, but would you like to explain what this:
bool AllegroStart::DoLogic() { if (update_logic) { return update_logic; update_logic = false; } }
should accomplish?
Ok so basically, i have broken tasks in main into logic tasks and render task and placed them in separate functions.
That method will return true if logic tasks need to be performed and then the boolean attribute used to say whether logic tasks need to be performed will be set to false again.
The reason i am using these functions is to allow the program extra time to process tasks if it is needed, this way you won't get a back log of render/logic tasks creating a more steady frame rate
I think he's trying to hint at the fact that your logic in DoLogic is a bit flawed.
Oh shit... man if i had a nickel for every time i did something like this.
Well the fact is thay is only an example of the flawed points in your code.
Which apart for some naive things like using a vector to store elements you...singularly allocated (I'm looking at those monsters....) it's not THAT bas as you state in the OP...there's just a bit of WAY TOO MUCH BOILERPLATE, but that's fine.
The problem is I can't really follow along your code, how it "flows".
You said that you get the SEGFAULT only the SECOND time you run over the 'got_event' bit...is this still the case after Edgar's suggestion?
EDIT:
The reason i am using these functions is to allow the program extra time to process tasks if it is needed, this way you won't get a back log of render/logic tasks creating a more steady frame rate
Barring my difficulties in understanding the code (which are there!) I don't think this would be the case since ouy're counting frames but not checking how much time you spend in logic.
Anyway I would suggest you drop this kind of optimization for now, it's quite an advanced topic...unlikely you will need that now.
On the other hand, I've (mentally) simulated two consecutive runs of the innner loop but can't find a good reason for al_get_next_event throw a fit without reason....it is very very very likely that the second time that is called there is no event (maybe also the first), but in that case that is clearly guarded but the bool check right after.
I now strongly suspect there's an unmatched closing curly brace somewhere...
Yes,
-I have changed the code so that my initialise_allgro function is being called before any other class objects are created.
-I have changed the code so that update_logic and update_render are being set to false after the methods have been called(by creating 2 methods which just set the values to false when called)
Game loop in main
Methods in AllegroStart
After changing this the program still crashes when it reaches bool got_event = al_get_next_event(event_queue, &allegro_event)
for the second time.
Just in case, I was editing my previous post before you posted again.
You may want to check.
EDIT: well braces match it seems...
ah, i'm following a tutorial and my understanding of how that piece of code works is clearly not right.
Despite this I just can't see any reason why it would stop on that line of code...
You could share you Visual Studio Solution, maybe someone (even me if I get back to my VS machine) can follow along the code.
Maybe
I'm just guessing here, but would it make any difference if you started the timer before registering it for events?
Probably not but you never know...
You should turn on your compiler warnings. On both of the highlighted lines if update_logic or render_frame is false then the program execution will fall through to whatever is after it in the binary code. The execution pointer could end up anywhere, and it is likely to crash indeterminately.
Your compiler should have said something like 'missing return statement for non-void function'. I think gcc would have warned about it with -Wall. I don't have a C++ compiler handy to test though.
If that's still not it, post all of your current main again and maybe attach a zip of your sources.
I strongly suspect that compiler optimizations would make the thing inlined and thus MAYBE leave things unchanged with no harm.
But I completely missed that due to cross-posting...whatever the crash, those two functions won't do any good cause there's nowhere the properties are being set again (to true).
I second Edgar's suggestion, maybewe are able to run the sources into a debugger...
{"name":"GoodNewsEveryone.jpg","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/6\/c6698fa12292b680f739bfd436f0731e.jpg","w":990,"h":749,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/6\/c6698fa12292b680f739bfd436f0731e"}
GOOD NEWS EVERYONE!
I was fed up of just sitting around hoping it would work so i continued programming a different section of the game and something i did seems to have fixed the problem!! Now to fix the 7234 other problems!
EDIT
Forgot to say THANK YOU to everybody for your help in improving my code in other areas! Never really use forums anymore but you guys were really helpful and didn't destroy me for my poor coding.