What's wrong with my code? (pdcurses/getmaxyx)

Posted by flarn2006 on Stack Overflow See other posts from Stack Overflow or by flarn2006
Published on 2010-06-15T02:25:49Z Indexed on 2010/06/15 2:32 UTC
Read the original article Hit count: 277

It gives me an access violation on the getmaxyx line (second line in the main function) and also gives me these two warnings:

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

Yes, it's the same code as in another question I asked, it's just that I'm making it more clear. And yes, I have written programs with pdcurses before with no problems.

#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;
}

© Stack Overflow or respective owner

Related posts about c++

Related posts about warning