Keep on getting error with class

Started by
2 comments, last by Aardvajk 16 years, 6 months ago
Hi. I'm using SDL in codeblocks with the SDL-gfxprimitives library. I'm trying to build a class that creates that creates a few different circles. This is the header file code. #include <SDL/SDL.h> #include <SDL/SDL_gfxprimitives.h> class Object { public: int createShip(SDL_Surface* dest,int x, int y, int radius,Uint8 r,Uint8 g,Uint8 b, Uint8 a); }; int Object:: createShip(SDL_Surface* dest,int x, int y, int radius,Uint8 r,Uint8 g,Uint8 b, Uint8 a) { int filledCircleRGBA( dest, x, y, radius, r, g, b, a); } This is how i'm trying to use it in my main function. Object ship; ship.createShip(screen,xpos,ypos,10,150,255,0,255); Where xpos,ypos and r are defined. I keep on gettin the error message: error: initializer expression list treated as compound expression. How can i fix this? Thanks.
Advertisement
You shouldn't have 'int' in front of 'filledCircleRGBA'.
Thanks.
It works.
You should also either return an int value from your createShip() method, or change its signature to return void if no return value is required.

You may only be getting a warning about this from the compiler at the moment, but if you later accidentally use the return value somewhere else, you will be using a garbage value.


If filledCircleRGBA() returns an int, you maybe want:

int Object:: createShip(SDL_Surface* dest,int x, int y, int radius,Uint8 r,Uint8 g,Uint8 b, Uint8 a){   return filledCircleRGBA( dest, x, y, radius, r, g, b, a);} 

This topic is closed to new replies.

Advertisement