Pregunta

Me da una violación de acceso en la línea getmaxyx (segunda línea en la función principal) y también me da estas dos advertencias:

LINK : warning LNK4049: locally defined symbol "_stdscr" imported
LINK : warning LNK4049: locally defined symbol "_SP" imported

Sí, es el mismo código que en otra pregunta que hice, es sólo que estoy haciendo que sea más clara. Y sí, he escrito programas con pdcurses antes sin problemas.

#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;
}
¿Fue útil?

Solución

Ha sido un largo tiempo desde que he utilizado maldiciones, pero yo supongo que necesita llamar initscr() antes cualquier otro maldiciones llamada Al igual que getmaxyx.

Además, probablemente también faltan algunos de comprobación de errores en la declaración de initscr y necesidad de utilizar los valores de retorno adecuada (tal vez usted tiene que pasarlo a otro método maldiciones?).

Otros consejos

Es necesario llamar antes initscr getmaxyx

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top