Library: SDL
Problem: Exception error
Compiler: Visual Studio 2008 compiler
Environment: Visual Studio 2008 Professional
Not quite sure how to title this problem, but I'll just spell it out. I've made a program using SDL, and upon running, I get an exception handle that requests a break or continue to the application. Upon breaking, it then shows me the debugging information.
Quote
- file 0x00372f98 {flags=0 format=0x00372ff0 w=640 ...} SDL_Surface *
flags 0 unsigned int
- format 0x00372ff0 {palette=0x00000000 BitsPerPixel='' BytesPerPixel='' ...} SDL_PixelFormat *
- palette 0x00000000 {ncolors=??? colors=??? } SDL_Palette *
ncolors CXX0030: Error: expression cannot be evaluated
colors CXX0017: Error: symbol "" not found
BitsPerPixel 24 '' unsigned char
BytesPerPixel 3 '' unsigned char
Rloss 0 unsigned char
Gloss 0 unsigned char
Bloss 0 unsigned char
Aloss 8 '' unsigned char
Rshift 0 unsigned char
Gshift 8 '' unsigned char
Bshift 16 '' unsigned char
Ashift 0 unsigned char
Rmask 255 unsigned int
Gmask 65280 unsigned int
Bmask 16711680 unsigned int
Amask 0 unsigned int
colorkey 0 unsigned int
alpha 255 'ÿ' unsigned char
w 640 int
h 480 int
pitch 1920 unsigned short
pixels 0x00980020 void *
offset 0 int
hwdata 0x00000000 private_hwdata *
- clip_rect {x=0 y=0 w=640 ...} SDL_Rect
x 0 short
y 0 short
w 640 unsigned short
h 480 unsigned short
unused1 0 unsigned int
locked 0 unsigned int
map 0x0037a030 SDL_BlitMap *
format_version 1 unsigned int
refcount 1 int
- fileoptimized 0x00000000 {flags=??? format=??? w=??? ...} SDL_Surface *
flags CXX0030: Error: expression cannot be evaluated
format CXX0030: Error: expression cannot be evaluated
w CXX0030: Error: expression cannot be evaluated
h CXX0030: Error: expression cannot be evaluated
pitch CXX0030: Error: expression cannot be evaluated
pixels CXX0030: Error: expression cannot be evaluated
offset CXX0030: Error: expression cannot be evaluated
hwdata CXX0076: Error:
- clip_rect {x=??? y=??? w=??? ...} SDL_Rect
x CXX0030: Error: expression cannot be evaluated
y CXX0030: Error: expression cannot be evaluated
w CXX0030: Error: expression cannot be evaluated
h CXX0030: Error: expression cannot be evaluated
unused1 CXX0030: Error: expression cannot be evaluated
locked CXX0030: Error: expression cannot be evaluated
map CXX0076: Error:
format_version CXX0030: Error: expression cannot be evaluated
refcount CXX0030: Error: expression cannot be evaluated
flags 0 unsigned int
- format 0x00372ff0 {palette=0x00000000 BitsPerPixel='' BytesPerPixel='' ...} SDL_PixelFormat *
- palette 0x00000000 {ncolors=??? colors=??? } SDL_Palette *
ncolors CXX0030: Error: expression cannot be evaluated
colors CXX0017: Error: symbol "" not found
BitsPerPixel 24 '' unsigned char
BytesPerPixel 3 '' unsigned char
Rloss 0 unsigned char
Gloss 0 unsigned char
Bloss 0 unsigned char
Aloss 8 '' unsigned char
Rshift 0 unsigned char
Gshift 8 '' unsigned char
Bshift 16 '' unsigned char
Ashift 0 unsigned char
Rmask 255 unsigned int
Gmask 65280 unsigned int
Bmask 16711680 unsigned int
Amask 0 unsigned int
colorkey 0 unsigned int
alpha 255 'ÿ' unsigned char
w 640 int
h 480 int
pitch 1920 unsigned short
pixels 0x00980020 void *
offset 0 int
hwdata 0x00000000 private_hwdata *
- clip_rect {x=0 y=0 w=640 ...} SDL_Rect
x 0 short
y 0 short
w 640 unsigned short
h 480 unsigned short
unused1 0 unsigned int
locked 0 unsigned int
map 0x0037a030 SDL_BlitMap *
format_version 1 unsigned int
refcount 1 int
- fileoptimized 0x00000000 {flags=??? format=??? w=??? ...} SDL_Surface *
flags CXX0030: Error: expression cannot be evaluated
format CXX0030: Error: expression cannot be evaluated
w CXX0030: Error: expression cannot be evaluated
h CXX0030: Error: expression cannot be evaluated
pitch CXX0030: Error: expression cannot be evaluated
pixels CXX0030: Error: expression cannot be evaluated
offset CXX0030: Error: expression cannot be evaluated
hwdata CXX0076: Error:
- clip_rect {x=??? y=??? w=??? ...} SDL_Rect
x CXX0030: Error: expression cannot be evaluated
y CXX0030: Error: expression cannot be evaluated
w CXX0030: Error: expression cannot be evaluated
h CXX0030: Error: expression cannot be evaluated
unused1 CXX0030: Error: expression cannot be evaluated
locked CXX0030: Error: expression cannot be evaluated
map CXX0076: Error:
format_version CXX0030: Error: expression cannot be evaluated
refcount CXX0030: Error: expression cannot be evaluated
That is the information it provides. It's so strange, I really can't figure it out. I'm not great at debugging with the debugger, I usually only get the simple problems and fix it. The main section of code it's complaining about is a header file I made for loading images.
load_image.h:
// Header guard, which ensures no multiple delcarations
// or calls to this header file.
#ifndef LOAD_IMAGE
#define LOAD_IMAGE
// 'Load_Image()' when called loads an image specified.
SDL_Surface* Load_Image( const char *filename, bool colorkey = false )
{
// Image file's temporary holder.
// Loads the image specified in the parameters into
// temporary holder.
SDL_Surface* file = NULL;
file = IMG_Load( filename );
SDL_Surface* fileoptimized = NULL;
[B]fileoptimized = SDL_DisplayFormat( file );[/B]
Uint32 colorkeyi = SDL_MapRGB( fileoptimized->format, 0xFF, 0xFF, 0xFF );
SDL_SetColorKey( fileoptimized, SDL_SRCCOLORKEY, colorkeyi );
if( colorkey == true )
{
SDL_FreeSurface( file );
return fileoptimized;
}
// Returns the loaded image.
return file;
}
#endif
// End of header file guard.
It particularly whines about the line I've bolded in the code above. I'm sure it's not the direct problem, but you never know. I know it's a bit sloppy, and it's not truly well commented, but I've been at this one problem for a day or so now and haven't slept, so you can be aware that I just want it to work before I will waste time commenting more code that might not work.
Any help would be greatly appreciated :cool:.
P.S. If you need any extra code/info, please ask. I'm happy to provide.
EDIT: Sorry, I forgot to add the exception error I receive upon running the application.
Quote
Unhandled exception at 0x68129d00 in program.exe: 0xC0000005: Access violation reading location 0x0000013c.
It's really just memory violations, but you can be the judge of that.


Sign In
Create Account


Back to top









