[SDL] undefined reference?
Dec 24, 2013 at 6:43pm UTC
I have two functions:
1 2 3
static void CRect_RenderRect(int x, int y, int w, int h, SDL_Surface* dst, Uint8 colorR, Uint8 colorG, Uint8 colorB);
static void CRect_RenderRect(int x, int y, int w, int h, SDL_Surface* dst, Uint32 color);
And I call the second function like this:
CRect::CRect_RenderRect(0, 0, 640, 480, Surf_Display, bgColor);
Where bgColor is declared like this:
1 2 3 4 5
Uint32 bgColor;
..
bgColor = SDL_MapRGB(Surf_Display->format, 0x00, 0x00, 0x00);
When I call the function I get this error:
1 2
undefined reference to `CRect::CRect_RenderRect(int , int , int , int , SDL_Surface*, unsigned int )'|
||=== Build finished: 1 errors, 0 warnings (0 minutes, 0 seconds) ===|
It works however, if I call the first function like this:
CRect::CRect_RenderRect(0, 0, 640, 480, Surf_Display, 0x00, 0x00, 0x00);
Dec 24, 2013 at 6:54pm UTC
It looks like the last type(bgColor's) isn't Uint32 but unsigned int... Maybe try casting?
Topic archived. No new replies allowed.