在ubuntu下安装TurboC,make的时候出现了以下错误:
代码如下
  1. cc -O0 -g -DWITH_X -I/usr/X11R6/include -Wall -c -funsigned-char -o arc.o arc.c
  2. In file included from arc.c:36:0:
  3. graphics.h:485:12: error: conflicting types for ‘getmaxx’
  4. /usr/include/ncurses.h:849:28: note: previous declaration of ‘getmaxx’ was here
  5. graphics.h:489:12: error: conflicting types for ‘getmaxy’
  6. /usr/include/ncurses.h:850:28: note: previous declaration of ‘getmaxy’ was here
  7. make: *** [arc.o] 错误 1
  8.  
在google上搜索,相关结果都没有解决办法,没办法,只好自己来解决了。

1.找到graphics.h 第485行和第489行
代码如下
  1. extern int getmaxx (void);
  2. #ifdef getmaxy
  3. #undef getmaxy
  4. #endif
  5. extern int getmaxy (void);

把这几行都注释掉后再make,又出现了错误
代码如下
  1. getmaxx.c:35:1: error: expected identifier or ‘(’ before ‘void
  2. getmaxx.c:35:1: error: expected ‘)’ before ‘?’ token
  3. getmaxx.c:41:1: error: conflicting types for ‘getmaxy’
  4. /usr/include/ncurses.h:850:28: note: previous declaration of ‘getmaxy’ was here
  5.  

看来问题出现在/usr/include/ncurses.h这个头文件里面,“getmaxy"已经被graphics.h里面声明过了

2.还原
graphics.h, 找到/usr/include/ncurses.h第849行:
代码如下
  1. extern NCURSES_EXPORT(int) getmaxx (const WINDOW *);            /* generated */
  2. extern NCURSES_EXPORT(int) getmaxy (const WINDOW *);            /* generated */
把这两行注释掉,make
看着一行行的编译通过的代码闪过,就知道问题解决了


随便说说

还可以输200