开发者

Can't convert from 'int' to 'int *'

开发者 https://www.devze.com 2023-01-03 05:57 出处:网络
So I hav开发者_运维百科e these lines of code: int maxY, maxX; getmaxyx(stdscr, &maxY, &maxX);

So I hav开发者_运维百科e these lines of code:

int maxY, maxX;
getmaxyx(stdscr, &maxY, &maxX);

It gives me the following error:

error C2440: '=' : cannot convert from 'int' to 'int *'
        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast

twice for each time I use it. I'm not even using the = operator! The curses.h file is included. What am I doing wrong?


getmaxyx is a macro, which doesn't take int*, but int.
It resolves to something like

getmaxyx(S,Y,X) -> X=s->X, Y=s->Y

try

getmaxyx(stdscr, maxY, maxX); // without the & operator

see http://opengroup.org/onlinepubs/007908775/xcurses/getmaxyx.html

0

精彩评论

暂无评论...
验证码 换一张
取 消