Skip to main content
GameDev.net gamedev.net
🔒 Locked

access violaton

Started by 2122 Jul 11, 2006 at 9:58 PM 17 replies 2k views
Original Post
2122
2122
My programs compile fine, but when I run them it pops up a window that says: "Unhandled exception at 0x10252758 in testconsole.exe: 0xC0000005: Access violation reading location 0x74736568." It does this for most of my programs, but some work fine. What can I do about it?
DevLiquidKnight
DevLiquidKnight
Its obvious it can't read a location in memory, I think we would need to see the code to correctly identify the problem.
LessBread
LessBread
You probably have a bad pointer somewhere. This might help: Debugging hints.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
2122
2122
The debugging tips didn't help. I checked for all the errors I can think of.

#include <iostream>#include <string>using namespace std;struct teststruct{	int size;	string name;};int main(){	teststruct t1;	t1.size = 5;	t1.name = "teststruct1";	cout<<t1.name<<endl;	cout<<t1.size<<endl;	system("pause");}
Driv3MeFar
Driv3MeFar
If thats the entire program, it works fine for me.
2122
2122
Yep, thats the entire program.
DevLiquidKnight
DevLiquidKnight
It doesn't return an integer I don't think that would be a problem though.
Dave Hunt
Dave Hunt
Works fine for me. Perhaps your compiler installation is corrupted.
2122
2122
How can I tell if my compiler is corrupted? Or should I just uninstall and reinstall it? If I uninstall the microsoft visual c++ 2005 do I have to reregister to get a new one?
DevLiquidKnight
DevLiquidKnight
You would probably have to reinstall it. Which would probably mean yes you would need to reregister. I've heard a few other people mentioning that the Express Edition of VC2005 to be some what buggy.
2122
2122
I reinstalled it, and I wrote a completely different program that also gets that same error. It works fine on the bloodshed dev-cpp compiler. Is there another vc2005 to try?
ju2wheels
ju2wheels
If im not mistaken dont you need to include in order to use system("PAUSE") ?
2122
2122
I've never needed cstdlib to use system pause before, but I tried it anyway, and still got the same access violation right before the program closed.
Morpheus011
Morpheus011
Quote:
Original post by ju2wheels
If im not mistaken dont you need to include in order to use system("PAUSE") ?


you shouldn't need to include anything for the system commands.
Mastaba
Mastaba
How about simply stepping through the program to see on which line it bombs out? That program works perfectly fine for me in MSVC++ 2005 Express though. It is clear you have something very odd going on.
2122
2122
I tried that. It doesn't error until the program ends and it tries to quit.
Dave Hunt
Dave Hunt
Does this only happen when you run the program from the IDE, or also when you run it from the command line?

If only from the IDE, then did you do an uninstall before reinstalling VC? If not, you might want to try that.
DevLiquidKnight
DevLiquidKnight
Are you using a new project file as well? Perhaps the project file settings are incorrect? Did you change them around at all?
2122
2122
The project was new, and I didn't change any settings. It happens from both the command line, and the IDE. I messed up the uninstal I think, I'll try uninstalling and reinstalling again, and post back later.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.