Skip to main content
gamedev.net
🔒 Locked

Constructor error. (C++)

Started by Calin 4 replies 550+ views
Original Post
Calin
Calin
I have a couple of classes in my game that have empty constructors and distructors. I made some minor changes to my code (they had nothing to do with these constructors) and an error started to come up. When I run the game, in the initialization stage I recive a unhandled exception error. At break the debugger points to the ending braket of the constructor. I'v commented out both the declaration and the definition of the constructor. However when I launch the game same error appers pointing to another constructor. I'v started learning on exception handling using some tutorials, but I still need some advice on how to approach this problem. Any idea or advice is welcomed. Edit: I'v just tryed to comment out the second constructor, now the application breaks in a constructor that has some code inside.
My project`s facebook page is “DreamLand Page”
rip-off
rip-off
would need to see the source, i can't really imagine what the problem is that you're having. the only thing i can think of is that a superclass of one of you classes is using some function that throws an exception( or is throwing one itself )...

need more info, sorry.
Calin
Calin
Thanks for reply

How should I plug in some exception code to track down this error. I tried to use 'try' 'catch' aroung the constructors but the compiler wont compile this kind of code. Where should the try-throw-catch stand?
My project`s facebook page is “DreamLand Page”
okonomiyaki
okonomiyaki
Obviously the problem isn't with the constructors. It is quite hard to debug this without any code. Did you look at the call stack to see where it is initializing? It could be caused by a corrupt heap.

What changes did you make to the code? Even though they weren't dealing with the constructors, it's still important. You can easily affect parts of the code with changes elsewhere.
JohnBolton
JohnBolton
The "unhandled exception" error is not referring to C++ exceptions.

Typically, the problem is an invalid pointer (frequently the this pointer). Check the values of the pointers to make sure they are are valid -- not 0 or uninitialized (0xcccccccc or 0xcdcdcdcd), or some other bogus value.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Calin
Calin
Quote:

The "unhandled exception" error is not referring to C++ exceptions

:) Ups. Thanks for pointing this out.

Quote:

Did you look at the call stack to see where it is initializing?


The call stack initialization is in sound.dll, it's the change I was talking about. I moved my sound code to a dinamic linked library. I'll have to start looking what's wrong in this dll.

Thank you all for your help.
My project`s facebook page is “DreamLand Page”

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.