help: unhandled exception error

Started by
1 comment, last by Show 17 years, 10 months ago
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.
Advertisement
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.
Hey, thanks a lot. That fixed it.

This topic is closed to new replies.

Advertisement