Sign in to follow this  

Constructor error. (C++)

This topic is 4381 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4381 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this