 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
r.z. Guest
|
Posted: Mon Dec 18, 2006 10:10 am Post subject: strange runtime error - I need help debuginng |
|
|
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. |
|
| Back to top |
|
 |
John Carson Guest
|
Posted: Mon Dec 18, 2006 10:10 am Post subject: Re: strange runtime error - I need help debuginng |
|
|
"r.z." <gklkj (AT) hjkjhk (DOT) pl> wrote in message
news:em5dea$mc6$1 (AT) atlantis (DOT) news.tpi.pl
| Quote: | 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
--
John Carson |
|
| Back to top |
|
 |
r.z. Guest
|
Posted: Mon Dec 18, 2006 10:10 am Post subject: Re: strange runtime error - I need help debuginng |
|
|
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!! |
|
| Back to top |
|
 |
Salt_Peter Guest
|
Posted: Mon Dec 18, 2006 10:11 am Post subject: Re: strange runtime error - I need help debuginng |
|
|
r.z. wrote:
| Quote: | 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 |
|
| Back to top |
|
 |
John Carson Guest
|
Posted: Mon Dec 18, 2006 10:11 am Post subject: Re: strange runtime error - I need help debuginng |
|
|
"r.z." <gklkj (AT) hjkjhk (DOT) pl> wrote in message
news:em5dea$mc6$1 (AT) atlantis (DOT) news.tpi.pl
| Quote: | 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.
--
John Carson |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|