Ncurses 6.0编译错误 - 错误:在int之前预期')'。

25

问题描述

在Ubuntu 16.04 LTS上尝试安装ncurses 6.0时,编译错误导致安装失败:

In file included from ./curses.priv.h:325:0,
                 from ../ncurses/lib_gen.c:19:
_24273.c:843:15: error: expected ‘)’ before ‘int’
../include/curses.h:1631:56: note: in definition of macro ‘mouse_trafo’
#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
                                                    ^
Makefile:962: recipe for target '../objects/lib_gen.o' failed
make[1]: *** [../objects/lib_gen.o] Error 1
make[1]: Leaving directory '/home/netsamir/Sofware/Tmux/ncurses-6.0/ncurses'
Makefile:113: recipe for target 'all' failed
make: *** [all] Error 2

配置

netsamir@octopus:~/Sofware/Tmux/ncurses-6.0$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04 LTS
Release:    16.04
Codename:   xenial

netsamir@octopus:~/Sofware/Tmux/ncurses-6.0$ gcc --version
gcc (Ubuntu 5.3.1-14ubuntu2) 5.3.1 20160413
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

netsamir@octopus:~/Sofware/Tmux/ncurses-6.0$ cpp --version
cpp (Ubuntu 5.3.1-14ubuntu2) 5.3.1 20160413
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

1
这个问题在几个月前的bug-ncurses邮件列表中报告,并且已经得到了修复。问题出在Debian版本的mawk上。 - Thomas Dickey
2
Thomas Dickey的回答实际上为我提供了解决方法,而不像OP的被接受的答案。我只是通过编辑MKlib_gen.sh,将子shell中涉及awk的部分替换为PRG=gcc,从而简单地“黑客”了这个修复 - jyalim
2个回答

40

9
在进行配置之前,请先执行此操作。 - iamgr007
3
可以将其添加到configure命令中,以使其具有临时效果。例如:./configure <选项> CPPFLAGS="-P" - JohnMudd
2
@JohnMudd,那么还有CPPFLAGS=-P ./configure,但这取决于具有特定的shell。;-) - jpaugh

7

$ export CPPFLAGS="-P" 对于我在Ubuntu 16.04 LTS上的本地安装的ncurses 6.0也有效。


谢谢,TheDude。我正在寻找代码高亮文档。 - James Chung

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接