在函数 ‘ptmr_start’ 和 ‘ptmr_stop’ 中安装 Sphinxbase 时出现编译错误

标签 c speech-recognition cmusphinx pocketsphinx

我正在使用发行版 ( https://sourceforge.net/projects/cmusphinx/files/sphinxbase/5prealpha/ ) 中的 Sphinxbase 和 Pocketsphinx,在安装时出现以下错误:

/sphinxbase/src/libsphinxbase/util/profile.c: In function ‘ptmr_start’:
/sphinxbase/src/libsphinxbase/util/profile.c:185:19: error: storage size of ‘start’ isn’t known
     struct rusage start;        /* CPU time */
                   ^
/sphinxbase/src/libsphinxbase/util/profile.c:188:15: error: ‘RUSAGE_SELF’ undeclared (first use in this function)
     getrusage(RUSAGE_SELF, &start);
               ^
/sphinxbase/src/libsphinxbase/util/profile.c:188:15: note: each undeclared identifier is reported only once for each function it appears in
/sphinxbase/src/libsphinxbase/util/profile.c: In function ‘ptmr_stop’:
/sphinxbase/src/libsphinxbase/util/profile.c:224:19: error: storage size of ‘stop’ isn’t known
     struct rusage stop;         /* CPU time */
                   ^
/sphinxbase/src/libsphinxbase/util/profile.c:227:15: error: ‘RUSAGE_SELF’ undeclared (first use in this function)
     getrusage(RUSAGE_SELF, &stop);
               ^

我使用的是 Ubuntu,它在 Macintosh(也是 Unix)上编译得很好。

最佳答案

谢谢@TomKuschel 提供的链接。该链接提供了提示。事实证明这是错误的系统标志,因此未包含文件。包括<sys/time.h><sys/resource.h>解决了问题。

关于在函数 ‘ptmr_start’ 和 ‘ptmr_stop’ 中安装 Sphinxbase 时出现编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45224196/

相关文章:

c - 了解 C 宏语法和函数

c - 初始化包含数组的结构

c - 使用数字配方的 C 随机数

c++ - 为什么 SetupDiEnumDriverInfo 会为我的驱动程序提供两个版本号

javascript - Web Speech API 自定义词

javascript - 如何从 JavaScript 使用 Opus Codec

speech-recognition - HTK:HVite 找不到嗯

voice-recognition - 耳语时简单的语音识别

java - 边唱歌边连续语音识别?

python - pocketsphinx python 给出错误的时间戳