strange runtime error - I need help debuginng

R

r.z.

My program behaves very strange. I keep getting the following error:
'The instruction at "some address" referenced memory at "some address". The
memory could not be written"'
The program consists of:
int main( int argc, char* argv[] )
{
//here is some third party function that configures graphic environment
{
app my_app; //this is local so that I'm sure it's destroyed before
next step
}
//here is some third party function that cleans graphic environment
return 0;
}
But when, instead of my_app object, I put there all of its data members (app
class has no constructor or destructor), it gives me no error!! I don't know
what to do. I don't know how to debug in Visual Studio and I don't know how
wheteher it would help me understand what's going on since my program relies
on some third party dll.
 
R

r.z.

I commented out the third party functions and now I'm sure this error is
caused by this local object. But when I put there its data members instead
it gives me no error!!
 
S

Salt_Peter

r.z. said:
My program behaves very strange. I keep getting the following error:
'The instruction at "some address" referenced memory at "some address". The
memory could not be written"'
The program consists of:
int main( int argc, char* argv[] )
{
//here is some third party function that configures graphic environment
{
app my_app; //this is local so that I'm sure it's destroyed before
next step
}
//here is some third party function that cleans graphic environment
return 0;
}
But when, instead of my_app object, I put there all of its data members (app
class has no constructor or destructor), it gives me no error!! I don't know
what to do. I don't know how to debug in Visual Studio and I don't know how
wheteher it would help me understand what's going on since my program relies
on some third party dll.

If your app class/struct didn't have a constructor or a destructor,
your program would not be compileable, let alone run. The error above
depicts trying to write to read-only memory. I can think of 10 or more
ways i could purposefully generate such an error. We could be here
until Christmas( year 2050 ) discussing what hypothetically might, or
might not be happening.
Notice: C++ programmers are notoriously pathetic at guessing.

I'ld suggest trying over at a newsgroup that deals with Visual Studio
and/or whatever proprietary GUI library you are using.

Consult this list of possible newsgroups:
[5.9] Which newsgroup should I post my questions?
http://www.parashift.com/c++-faq-lite/how-to-post.html
 
J

John Carson

r.z. said:
I commented out the third party functions and now I'm sure this error
is caused by this local object. But when I put there its data members
instead it gives me no error!!

You have two options: learn how to debug or post code here that is
compileable and allows us to reproduce the error.

Debugging this shouldn't be hard. Just hit F5 for starters (assuming you
have a debug build). With luck, this will take you to the line with the
error.

If the line with the error is in some library rather than your code, and you
are confident that the problem is in your code, then open the Call Stack
window (you should find it in the menus under Debug->Windows). Do this with
the Debugger still running. In the call stack, double click on the highest
line that is in your own code. The problem should be near this line.
 
J

John Carson

r.z. said:
I commented out the third party functions and now I'm sure this error
is caused by this local object. But when I put there its data members
instead it gives me no error!!

I didn't realise what newsgroup I was in when replying.

You should ask questions like this in

microsoft.public.vc.language
or
microsoft.public.vc.ide_general
or
comp.os.ms-windows.programmer.win32
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top