Unterschied zwischen 'int&' und 'int'
-
Hi !
Mein Programm benutzt die ClanLib API (www.clanlib.org). Ist allerdings für meine Frage egal denke ich. Ich habe folgenden Code geschrieben:
int bpp = (int) sdl_surface->format->BytesPerPixel; unsigned int r_mask = (unsigned int ) sdl_surface->format->Rmask; unsigned int g_mask = (unsigned int ) sdl_surface->format->Gmask; unsigned int b_mask = (unsigned int ) sdl_surface->format->Bmask; unsigned int a_mask = (unsigned int ) sdl_surface->format->Amask; unsigned int colorkey = (unsigned int ) sdl_surface->format->colorkey; CL_PixelFormat pixel_format( bpp , r_mask , g_mask , b_mask , a_mask , false, colorkey , CL_PixelFormat::rgba8888 );
Der Compiler spuckt mir diese Fehlermeldung aus:
LevelRenderer/LevelRenderer.cpp:133: error: no matching function for call to ` CL_PixelFormat::CL_PixelFormat(const int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, bool, unsigned int&, CL_PixelFormat&)' /usr/local/include/ClanLib-0.7/ClanLib/Display/pixel_format.h:79: error: candidates are: CL_PixelFormat::CL_PixelFormat(int, unsigned int, unsigned int, unsigned int, unsigned int, bool, unsigned int, CL_PixelFormatType)
Wenn ich das ganze ein wenig modifiziere mittels:[cpp]
int bpp = (int) sdl_surface->format->BytesPerPixel;
unsigned int r_mask = (unsigned int ) sdl_surface->format->Rmask;
unsigned int g_mask = (unsigned int ) sdl_surface->format->Gmask;
unsigned int b_mask = (unsigned int ) sdl_surface->format->Bmask;
unsigned int a_mask = (unsigned int ) sdl_surface->format->Amask;
unsigned int colorkey = (unsigned int ) sdl_surface->format->colorkey;
CL_PixelFormat pixel_format(4 , r_mask , g_mask , b_mask , a_mask , false, colorkey , CL_PixelFormat::rgba8888 );
[/cpp]erhalte ich folgende Ausgabe vom Compiler:
LevelRenderer/LevelRenderer.cpp:133: error: no matching function for call to ` CL_PixelFormat::CL_PixelFormat( :arrow: [b]int[/b], unsigned int&, unsigned int&, unsigned int&, unsigned int&, bool, unsigned int&, CL_PixelFormat&)' /usr/local/include/ClanLib-0.7/ClanLib/Display/pixel_format.h:79: error: candidates are: CL_PixelFormat::CL_PixelFormat(int, unsigned int, unsigned int, unsigned int, unsigned int, bool, unsigned int, CL_PixelFormatType)
Ehrlich gesagt, sehe ich jetzt nicht den Unterschied zwischen einem 'int bpp' oder dem Wert '4' bzw die Compilerausgabe 'int&' und 'int'.
Wie kann ich diesen Fehler beheben.
Thx
Tom
-
Der Knackpunkt dürfte der letzte Parameter sein.
CL_PixelFormat::CL_PixelFormat(const int&, unsigned int&, unsigned int&,
unsigned int&, unsigned int&, bool, unsigned int&, CL_PixelFormat&)'andidates
are: CL_PixelFormat::CL_PixelFormat(int, unsigned int, unsigned int,
unsigned int, unsigned int, bool, unsigned int, CL_PixelFormatType)
-
Oh mann ! Davor hab ich fast ne halbe Stunde gehockt und nichts gesehen, das gibts doch garnicht... Thx.
mfg
Tom