它给了我在 getmaxyx 行(主函数的第二行)上的访问冲突,并且还给了我这两个警告:
LINK : warning LNK4049: locally defined symbol "_stdscr" imported
LINK : warning LNK4049: locally defined symbol "_SP" imported
是的,它与我问的另一个问题中的代码相同,只是我让它更清楚。是的,我以前用 pdcurses 编写过程序,没有任何问题。
#include <time.h>
#include <curses.h>
#include "Ball.h"
#include "Paddle.h"
#include "config.h"
int main(int argc, char *argv[])
{
int maxY, maxX;
getmaxyx(stdscr, maxY, maxX);
Paddle *paddleLeft = new Paddle(0, KEY_L_UP, KEY_L_DOWN);
Paddle *paddleRight = new Paddle(maxX, KEY_R_UP, KEY_R_DOWN);
Ball *ball = new Ball(paddleLeft, paddleRight);
int key = 0;
initscr();
cbreak();
noecho();
curs_set(0);
while (key != KEY_QUIT)
{
key = getch();
paddleLeft->OnKeyPress(key);
paddleRight->OnKeyPress(key);
}
endwin();
return 0;
}