Welcome! Log In Create A New Profile


Image loading errors

Posted by WiiPhlex 
Image loading errors
August 30, 2008 11:02AM
I keep getting an error saying "expected unqualified-id before 'if'"

Heres the code:


#include "menu.h"
#include "gfx/menu_screen.h"

using namespace wsp;

Sprite sprite;
Image image;

if(image.LoadImage(menu_screen) != IMG_LOAD_ERROR_NONE)exit(0);

when I remove the if statment it compiles fun (under GCC) although I need to load the image. This method loads an image from the buffer which in this case is an image that I encoded with raw2c which is found in gfx/menu_screen.h

So yeah, can someone give me some help?

Edited 3 time(s). Last edit at 08/30/2008 01:53PM by WiiPhlex.
Re: Image loading errors
August 30, 2008 01:55PM
It looks like I can only load Images in the main method which is rather annoying.
Re: Image loading errors
August 30, 2008 06:45PM
Yeah, it's a limit in the design of c++, you can't execute code outside of a function.
Re: Image loading errors
August 31, 2008 01:48AM
Edit 3(?): all fixed

Edited 2 time(s). Last edit at 08/31/2008 03:48AM by WiiPhlex.
Sorry, only registered users may post in this forum.

Click here to login