You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用PDCurses 3.4开发C文本游戏遇类型声明错误求助

问题:PDCurses 3.4 与C17标准bool类型冲突导致编译错误

我正在用PDCurses 3.4开发C语言文本类游戏,按对应版本教程安装,但新版本(如3.9)安装流程差异极大,无法理解。

项目文件结构

  • bin
    • main
  • include
    • blocks.h
    • grid.h
  • lib
    • pdcurses.lib
  • pdcurses
    • curses.h
    • panel.h
  • blocks.c
  • grid.c
  • main.c
  • makefile
  • pdcurses.dll

编译错误信息

执行make命令时出现如下错误:

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

使用的编译命令

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

已尝试的无效方案

  • 重装PDCurses 3.4
  • 将curses.h中的typedef unsigned char bool;替换为#include <stdbool.h>

解决办法

感谢William McBrine的解答,我通过下载PDCurses 3.9,按照wincon/README.md中的构建说明操作,并将生成的文件添加到MinGW文件夹中,成功解决了问题!


内容的提问来源于stack exchange,提问作者Hartsaxena

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 19:02:39