getmaxyx always returns 1 and 1 in pdcurses instead of the number of rows and columns

132 Views Asked by At
#include <curses.h>

int main() {
    initscr();
    int row, col;
    getmaxyx(stdscr, row, col);
    printw("%d %d", row, col);
    getch();
}

If I compile this code with ncurses (gcc -lncurses test.c), I get, as expected, the number of rows and columns of the terminal (31 and 88 in my case), but if I compile it with pdcurses (gcc -lpdcurses -lSDL test.c) I get 1 and 1 as the output. Why is that? Am I missing something? Resizing the terminal with resize_term(100, 100); does not change the output

1

There are 1 best solutions below

1
Duddino On

For some reasons pdcurses doesn't like ncurses curses.h, changing the header to xcurses/curses.h solves the issue for me