声明void abort()抛出不同的异常 [英] Declaration of void abort() throws different exceptions
问题描述
我试图为 Festival
写一些 C ++
代码(使用C ++ API)试图编译。这是我如何调用 g ++
:
I am trying to write some C++
code (using the C++ API) for Festival
and am getting stuck while trying to compile. Here is how I invoke g++
:
g ++ -Wall -pedantic -I .. / -I ../ speech_tools / include / helloFestival.C -oh -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
我得到的错误是:
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
The error I get is:
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中的冒犯行将是:
externCvoid abort(void);
The offending line in EST_String.h would be:
extern "C" void abort(void);
main $ c> function我已经使用可以在这里找到:festvox.org/docs/manual-1.4.3/festival_28.html#SEC133
The main()
function I have used can be found here: festvox.org/docs/manual-1.4.3/festival_28.html#SEC133
编译和链接说明这里是我使用的那些。
The compilation and linking instructions given here are the ones I have used.
我在网上看过这个问题,一些解决方案建议,这可能是因为向后兼容性,或调用中止)我的问题是:
I have looked this problem on the net and some of the solutions suggest that it maybe because of backward compatibility, or calling an abort() from within a destructor etc. My questions are:
- 如何摆脱这个?
- 为什么会看到这个错误?
推荐答案
您看到此错误,因为speech_tools中的abort强制的abort()函数。可能没有真正好,干净的方法来解决这个问题。如果你自己写了EST_String.h,那么用不同的方式命名函数。
You see this error because the abort() function in speech_tools conflicts with the standard-mandated abort() function. There's probably no really good, clean way to fix this. If you have written EST_String.h yourself, name the function differently.
如果没有,请不要在同一个文件中包含stdlib.h和EST_String.h。是的,这是有限的和坏的,但你在这里的一个糟糕的情况。
If not, don't include stdlib.h and EST_String.h in the same file. Yes, that's limiting and bad, but you are in a crappy situation here.
这篇关于声明void abort()抛出不同的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!