【发布时间】:2011-11-14 13:43:42
【问题描述】:
我正在尝试为 Festival 编写一些 C++ 代码(使用 C++ API),但在尝试编译时遇到了问题。这是我调用g++的方式:
g++ -Wall -pedantic -I../ -I../speech_tools/include/ helloFestival.C -o h -L../festival/src/lib/libFestival.a -L../speech_tools/lib/libestools.a -L../speech_tools/lib/libestbase.a -L../speech_tools/lib/libeststrings.a |& tee festival.runLog
我得到的错误是:
In file included from ../speech_tools/include/EST.h:48,
from ../festival/src/include/festival.h:47,
from helloFestival.C:4:
../speech_tools/include/EST_String.h:50: error: declaration of ‘void abort()’ throws different exceptions
/usr/include/stdlib.h:513: error: from previous declaration ‘void abort() throw ()’
EST_String.h 中的违规行是:extern "C" void abort(void);
我使用的main()函数可以在这里找到:festvox.org/docs/manual-1.4.3/festival_28.html#SEC133
这里给出的编译和链接说明是我用过的。
我在网上看过这个问题,一些解决方案表明它可能是因为向后兼容性,或者从析构函数中调用 abort() 等。我的问题是:
- 如何摆脱这种情况?
- 为什么我会看到这个错误?
【问题讨论】:
-
你能创建一个最小的例子吗?
-
这很好,22。我想你可以做到
extern "C" void abort(void) throw();?这将是一个有趣的悖论,因为 C 不知道异常 -
@VJo:我使用的示例可以在这里:festvox.org/docs/manual-1.4.3/festival_28.html#SEC133 -
main()功能与页面上的相同。链接和编译说明也可以在上面找到。 -
@sehe:这就是我在遇到一些帖子后尝试的,这些帖子说
abort()的原始定义会抛出,而这不会。这也不起作用,我以undefined reference to结束错误。