Sign in to follow this  

expression cannot be evaluated... Well why not?

This topic is 3489 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

okay so I have my engine declared as: Engine::TheEngine * MyEngine; now when i attempt to execute the function: MyEngine->Display.InitializeDevice(*whole bunch of parameters*) it pops up with an unhandled exception, access violation. then when I check in VS' Autos list, every variable listed under private in my display class has either "expression cannot be evaluated" or "symbol "" not found" next to it. This is not a problem if MyEngine isnt declared as a pointer: Engine::TheEngine MyEngine; what exactly am i doing wrong here? I dont even know where to start

Share this post


Link to post
Share on other sites
Engin::TheEngine *MyEngine is creating a pointer. This will be uninitialised and will probably point to address 0.

When you try to call your methods on this it will try to access memory at or around location 0 in memory, which is causing your crash.

You need to create your enigine object with something like

MyEngine = new Engine::TheEngine();

Share this post


Link to post
Share on other sites
Null pointer sounds like the problem here.

When you get an access violation though, make sure to include the extra information it gives you when looking for help. You'll get a message something like 'Unhandled Exception (0xC0000005): Access Violation in process.exe at 0xBAADCODE, reading address 0x00000000'.

That's not verbatim, but there is something like the bolded - the exact action causing the violation. The location of the error (0xBAADCODE in the example) tells you what type of code is causing you the problem (is it happening directly from your own code, a DLL you've loaded, or in kernel space somewhere) and the target address of your read or write tells you what's likely to be the problem. If that target address is close to 0, then you've got a null pointer problem (attempting to access members of a class or struct through a null pointer will usually result in target addresses that are close to 0, but not actually at 0).

Share this post


Link to post
Share on other sites
...which will leak, unless there's a delete MyEngine somewhere at the end of execution. My suggestion to the OP is to read up on basic C++ theory first, before diving into a pool of dangling pointers (but still, it's only a suggestion).

EDIT: answer with respect to the first two replies

Share this post


Link to post
Share on other sites

This topic is 3489 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