By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,435 Members | 1,485 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,435 IT Pros & Developers. It's quick & easy.

strange runtime error - I need help debuginng

P: n/a
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.
Dec 18 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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!!
Dec 18 '06 #2

P: n/a

r.z. wrote:
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

Dec 18 '06 #3

P: n/a
"r.z." <gk***@hjkjhk.plwrote in message
news:em**********@atlantis.news.tpi.pl
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
Dec 18 '06 #4

P: n/a
"r.z." <gk***@hjkjhk.plwrote in message
news:em**********@atlantis.news.tpi.pl
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
Dec 18 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.