Sign in to follow this  
Farraj

Problem with a class

Recommended Posts

Hi everyone. I’m having trouble with something. In my SubSystemManager.h file I have a class and a function that uses that class as an argument: class SubSystemManager { … … … void someFunction(void); }; unsigned int GetEntity(SubSystemManager *ssMgr); Now in my SubSystemManager.cpp I call the GetEntity function from inside one of the class functions like so: void SubSystemManager::someFunction(void) { GetEntity(this); } unsigned int GetEntity(SubSystemManager *ssMgr) { // some code Return 0; } OK, now, the above compiles without any errors, but when I run the program it crashes when the class function calls the GetEntity function. It doesn’t matter if the GetEntity function is empty (only return 0, I tried it) the program crashes. GetEntity works fine when I call it anywhere outside the SubSystemManager.cpp file. Any idea why this happens? Cheers

Share this post


Link to post
Share on other sites
What do you mean it "crashes"? What's the exact error you get? Also, what compiler are you using, and have you tried doing a rebuild all?

Share this post


Link to post
Share on other sites
Oh, sorry. I forgot to add this.

I’m using VC++2005 on a windows xp. When I say crash, I mean when the program reaches that line it freezes and I get a windows message telling me that there was a problem (it doesn’t say).

And yes, I did use Rebuild All. And it crashes on both Debug and Release builds.

Share this post


Link to post
Share on other sites

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