ccursespdcurses

pdcurses installation has a type declaration error


I'm making a text-based game in C using the pdcurses library (version 3.4). I'm following a tutorial for the installation of pdcurses, and the tutorial uses version 3.4. If I download a newer version (e.g. 3.9), it seems to be a completely different installation process which I don't understand at all.

This is the file system of my project, in case I installed it incorrectly unknowingly.

When I run make, I get this error:

pdcurses/curses.h:92:23: error: two or more data types in declaration specifiers 92 | typedef unsigned char bool; /* PDCurses Boolean type */ | ^~

My compilation command: gcc -std=c17 -g -Wall -Iinclude -Ipdcurses main.c blocks.c grid.c -o bin\tetris -Llib

I've tried reinstalling pdcurses, and even substituting the typedef unsigned char bool; with #include <stdbool.h>

EDIT: Thanks to William McBrine's responses, I have fixed the issue by simply downloading PDCurses 3.9 and following the build instructions in wincon/README.md and adding the files to my MinGW folder. Thank you!


Solution

  • Your basic problem is that bool is part of standard C since C99, but is also required by the curses spec, which predates C99. PDCurses targets C89 and later. This particular conflict was addressed in PDCurses 3.7, with some further adjustment in 3.9, although it remains a potential problem.

    3.9 arranges its file hierarchy slightly differently from 3.4, but the difference isn't that great. I don't know what tutorial you're referencing, but if I did, perhaps I could clarify things. Getting you onto the latest available version is by far the best solution.

    Meanwhile, do you really need that "-std=c17"? You could perhaps try "-std=c89".