我正在尝试写一些C++
代码(使用 C++ API)Festival
并且在尝试编译时陷入困境。这是我调用的方式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);
The main()
我使用过的函数可以在这里找到:festvox.org/docs/manual-1.4.3/festival_28.html#SEC133
这里给出的编译和链接说明是我使用过的。
我在网上查看了这个问题,一些解决方案表明这可能是因为向后兼容性,或者从析构函数中调用 abort() 等。我的问题是:
- 我该如何摆脱这个?
- 为什么我会看到这个错误?
您会看到此错误,因为 voice_tools 中的 abort() 函数与标准规定的 abort() 函数冲突。可能没有真正好的、干净的方法来解决这个问题。如果您自己编写了 EST_String.h,请以不同的方式命名该函数。
如果不是,请勿将 stdlib.h 和 EST_String.h 包含在同一文件中。是的,这有限制而且很糟糕,但你现在的处境很糟糕。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)