Re: cannot convert 'SDL_DisplayMode' to 'SDL_DisplayMode*
Brian Puthuff <[email protected]> Wed, 8 Feb 2017 16:24:45 -0800
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <CAPh_eMHdOKQFjeWKnVyCFFcK-j568SVtByFHDtbiSKy2bxspxQ@mail.gmail.com> |
int gobot( int * horizontal, int* vertical, &dm )
{
//SDL_GetDesktopDisplayMode(0, &dm);
*horizontal = dm->w;
*vertical = dm->h;
return 0;
}
Should be:
int gobot( int * horizontal, int* vertical, *SDL_DisplayMode* dm* )
{
//SDL_GetDesktopDisplayMode(0, &dm);
*horizontal = dm->w;
*vertical = dm->h;
return 0;
}
That third argument is incorrect on that first version. The definition
arguments need to match the declaration arguments. That third argument is a
pointer to a structure. The only time you pass &dm is when you actually
call the function. Not during declaration and definition.
On Feb 8, 2017 4:08 PM, "speartip" <[email protected]> wrote:
Deployed with changes; errors persistent:
Code:
horizontal = 0; vertical = 0;
SDL_DisplayMode dm;
cout<<"Gobot call:";
gobot(&horizontal,&vertical, &dm);
Code:
#include"SDL.h"
int SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * dm);
int gobot( int * horizontal, int * vertical, SDL_DisplayMode * dm);
Code:
#include "SDL.h"
#include "gobot.h"
int gobot( int * horizontal, int* vertical, &dm )
{
//SDL_GetDesktopDisplayMode(0, &dm);
*horizontal = dm->w;
*vertical = dm->h;
return 0;
}
error:
Code:
.\src\gobot.cpp:15:45: error: 'dm' has not been declared
int gobot( int * horizontal, int* vertical, dm )
^
..\src\gobot.cpp: In function 'int gobot(int*, int*, int)':
..\src\gobot.cpp:18:18: error: 'dm' was not declared in this scope
* horizontal = dm->w;
_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org