Sign in to follow this  
Show

help: unhandled exception error

Recommended Posts

void DR::DrawScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(-11.0f, 9.0f,-35.0f); char tile(' '); vector<char> haha; haha = map.CurrentMap(); tile = haha[0]; } map.CurrentMap() returns a vector<char> value. I'm using VC++ .NET 2003. In debug mode, I keep getting the following error at the 'tile = haha[0]' line. Unhandled exception at 0x0041e489 in DR.exe: 0xC0000005: Access violation reading location 0x00000000. What's wrong with my code? The program seems to run fine if I just click the .exe file.

Share this post


Link to post
Share on other sites
Sounds like you have different "current directories" for running within the IDE and just from clicking on the exe.

You are probably loading a file with a relative path, so map.CurrentMap() is failing and "haha" is staying at size=0 which means haha[0] is out-of-bounds.

Share this post


Link to post
Share on other sites

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