Ergebnistyp fuer Konstruktoren nicht erlaubt ?!



  • #include "SDL/SDL.h"
    #include "SDL_SurfaceWrapper.h"
    
    SDL_SurfaceWrapper::SDL_SurfaceWrapper(SDL_Surface *src)
    {
    	copySurface(src);
    }
    SDL_SurfaceWrapper::SDL_SurfaceWrapper(const SDL_SurfaceWrapper &s)
    {
    	copySurface(s.surface);
    }
    	//dtor
    SDL_SurfaceWrapper::~SDL_SurfaceWrapper()
    {
    	SDL_FreeSurface(surface);
    }
    
    	//assign
    const SDL_SurfaceWrapper& SDL_SurfaceWrapper::operator=(const SDL_SurfaceWrapper &right)
    {
    	copySurface(right.surface);
    }
    	//copy a surface include pixel data
    void SDL_SurfaceWrapper::copySurface(SDL_Surface *src)
    {
    	surface = SDL_CreateRGBSurface( SDL_SWSURFACE, src->w, src->h, src->format->BitsPerPixel, src->format->Rmask, src->format->Gmask, src->format->Bmask, src->format->Amask );
    	SDL_BlitSurface( src, NULL, surface, NULL );
    }
    		//create an empty surface from a surface
    void SDL_SurfaceWrapper::fromSurface(SDL_Surface *src)
    {
    	surface = SDL_CreateRGBSurface( SDL_SWSURFACE, src->w, src->h, src->format->BitsPerPixel, src->format->Rmask, src->format->Gmask, src->format->Bmask, src->format->Amask );
    }
    	//same as above but with user-set size
    void SDL_SurfaceWrapper::fromSurface(int w, int h, SDL_Surface *src)
    {
    
    	surface = SDL_CreateRGBSurface( SDL_SWSURFACE, w, h, src->format->BitsPerPixel, src->format->Rmask, src->format->Gmask, src->format->Bmask, src->format->Amask );
    }
    	//same for wrapper
    
    	//create an empty surface from a surface
    void SDL_SurfaceWrapper::fromSurface(SDL_SurfaceWrapper src)
    {
    	surface = SDL_CreateRGBSurface( SDL_SWSURFACE, src.surface->w, src.surface->h, src.surface->format->BitsPerPixel, src.surface->format->Rmask, src.surface->format->Gmask, src.surface->format->Bmask, src.surface->format->Amask );
    }
    	//same as above but with user-set size
    void SDL_SurfaceWrapper::fromSurface(int w, int h, SDL_SurfaceWrapper src)
    {
    	surface = SDL_CreateRGBSurface( SDL_SWSURFACE, w, h, src.surface->format->BitsPerPixel, src.surface->format->Rmask, src.surface->format->Gmask, src.surface->format->Bmask, src.surface->format->Amask );
    }
    

    ------->

    E:\Uni\code\PixGraph\SDL_SurfaceWrapper.cpp(6) : error C2533: 'SDL_SurfaceWrapper::SDL_SurfaceWrapper' : Ergebnistyp fuer Konstruktoren nicht erlaubt

    header datei:

    #ifndef SDL_SurfaceWrapper_h
    #define SDL_SurfaceWrapper_h 1
    
    class SDL_SurfaceWrapper
    {
    public:
    	// copy ctor
        SDL_SurfaceWrapper(const SDL_SurfaceWrapper &s);
    	//
    	SDL_SurfaceWrapper(SDL_Surface *src);
    	//dtor
    	virtual ~SDL_SurfaceWrapper();
    
    	//assign
    	const SDL_SurfaceWrapper& operator=(const SDL_SurfaceWrapper &right);
    	//copy a surface include pixel data
    	void copySurface(SDL_Surface *src);
    	//create an empty surface from a surface
    	void fromSurface(SDL_Surface *src);
    	//same as above but with user-set size
    	void fromSurface(int w, int h, SDL_Surface *src);
    	//same for wrapper
    
    	//create an empty surface from a surface
    	void fromSurface(SDL_SurfaceWrapper src);
    	//same as above but with user-set size
    	void fromSurface(int w, int h, SDL_SurfaceWrapper src);
    	//the real surface:
    	SDL_Surface *surface;
    private:
    
    }
    #endif
    

    wie kommt diese fehlermeldung zu stande? ich seh da keinen ergebnisstyp



  • semikolon hinter der klassendefinition vergessen.


Anmelden zum Antworten