无法从“诠释”转换为“诠释*”
问题描述:
所以我有几行代码:无法从“诠释”转换为“诠释*”
int maxY, maxX;
getmaxyx(stdscr, &maxY, &maxX);
它给了我下面的错误:
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
两次,每次我用它。我甚至没有使用=操作符!包含curses.h文件。我究竟做错了什么?
答
getmaxyx
是一个宏,它不采用int *,而是int。
它解析为像
getmaxyx(S,Y,X) -> X=s->X, Y=s->Y
尝试
getmaxyx(stdscr, maxY, maxX); // without the & operator
看到http://opengroup.org/onlinepubs/007908775/xcurses/getmaxyx.html
谢谢!我喜欢我得到的快速反应。 – flarn2006 2010-06-14 23:12:06