Access violation
When I run this code I get an error:
#include <gl\glaux.h>
AUX_RGBImageRec *RGBImage;
void main(void)
{
RGBImage->sizeX=128;
}
The error says
Unhandled exception in blah.exe: 0xC0000005: Access violation.
Any ideas?
RGBImage is a pointer. You''re trying to use a pointer that doesn''t point anywhere, thus, you''ll get an access violation.
Gotta use something like
AUX_RGBImageRec *RGBImage = new AUX_RGBImageRec;
or perhaps even
AUX_RGBImageRec *RGBImage = auxDIBImageLoad("filename")
Gotta use something like
AUX_RGBImageRec *RGBImage = new AUX_RGBImageRec;
or perhaps even
AUX_RGBImageRec *RGBImage = auxDIBImageLoad("filename")
I tried it and I''m getting the same error
#include <gl\glaux.h>
AUX_RGBImageRec *RGBImage = new AUX_RGBImageRec;
void main(void)
{
RGBImage->sizeX=128;
}
#include <gl\glaux.h>
AUX_RGBImageRec *RGBImage = new AUX_RGBImageRec;
void main(void)
{
RGBImage->sizeX=128;
}
Nevermind.. I don''t know what happened, but I tried it again and it said the C++ file I had wasn''t included in the project. I don''t know what the hell is going on anymore. BTW It worked, thanks for the help!
I hope you plan on cleaning that memory up after you''ve finished with it.
delete RGBImage;
delete RGBImage;
Good call. Memory Leaks bad 
I will admit, I''m just starting C++. I''ve been working with VB mostly, so there are a lot of new things like memory allocation and pointers. I''d rather teach myself or learn from others rather than go to school for it. I seem to get a better handle on it that way. I appreciate everyone''s help.

I will admit, I''m just starting C++. I''ve been working with VB mostly, so there are a lot of new things like memory allocation and pointers. I''d rather teach myself or learn from others rather than go to school for it. I seem to get a better handle on it that way. I appreciate everyone''s help.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement