基本节日节目具有未定义的参考错误
Basic festival program has undefined reference errors
我目前正在尝试编译这个基本的节日节目
#include <iostream>
#include <festival/festival.h>
#define HEAP_SIZE 210000
#define LOAD_INIT_FILES 1
using namespace std;
int main()
{
festival_initialize(LOAD_INIT_FILES, HEAP_SIZE);
festival_say_text("Hello World");
festival_wait_for_spooler();
return 0;
}
当我尝试使用 g++ 构建程序时,出现以下错误:
speech_tools/lib/libestools.a $USER/Downloads/festival/speech_tools/lib/libeststring.a
$USER/Downloads/festival/speech_tools/lib/libestools.a(EST_PST.o): In function `EST_PredictionSuffixTree::test(EST_String)':
EST_PST.cc:(.text+0x2d30): undefined reference to `confusion(EST_TKVL<EST_String, EST_String>&, EST_TList<EST_String>&)'
EST_PST.cc:(.text+0x2d40): undefined reference to `print_confusion(EST_FMatrix const&, EST_TKVL<EST_String, EST_String>&, EST_TList<EST_String>&)'
$USER/Downloads/festival/speech_tools/lib/libestools.a(wfst_ops.o): In function `EST_WFST::determinize(EST_WFST const&)':
wfst_ops.cc:(.text+0x1136): undefined reference to `EST_THash<int, int>::EST_THash(int, unsigned int (*)(int const&, unsigned int))'
wfst_ops.cc:(.text+0x1206): undefined reference to `EST_THash<int, int>::val(int const&, int&) const'
wfst_ops.cc:(.text+0x122f): undefined reference to `EST_THash<int, int>::add_item(int const&, int const&, int)'
wfst_ops.cc:(.text+0x1568): undefined reference to `EST_THash<int, int>::~EST_THash()'
wfst_ops.cc:(.text+0x17d8): undefined reference to `EST_THash<int, int>::~EST_THash()'
$USER/Downloads/festival/speech_tools/lib/libestools.a(editline.o): In function `readline':
editline.c:(.text+0x7d2a): undefined reference to `tgetent'
editline.c:(.text+0x7d85): undefined reference to `tgetstr'
editline.c:(.text+0x7d9d): undefined reference to `tgetstr'
editline.c:(.text+0x7db5): undefined reference to `tgetstr'
editline.c:(.text+0x7dcd): undefined reference to `tgetstr'
editline.c:(.text+0x7e65): undefined reference to `tgetstr'
editline.c:(.text+0x7e87): undefined reference to `tgetnum'
editline.c:(.text+0x7e99): undefined reference to `tgetnum'
editline.c:(.text+0x7f21): undefined reference to `tgetstr'
collect2: error: ld returned 1 exit status
根据 http://festvox.org/docs/manual-2.4.0/festival_28.html#C_002fC_002b_002b-API,除了与festival/src/lib/libFestival.a,speech_tools/lib/libestools.a,speech_tools/lib/libestbase.a和speech_tools/lib/libeststring.a链接外,我还在搜索路径中添加了festival/src/include和speech_tools/include
。我正在尝试使用 g++ 和 festival 2.4.0 在 Arch Linux 上构建它。
编辑:我正在使用的构建命令是
g++ -o bin/Debug/festival_test obj/Debug/main.o /usr/lib/libcurl.so /home/joshua/Downloads/festival/festival/src/lib/libFestival.a /home/joshua/Downloads/festival/speech_tools/lib/libestbase.a /home/joshua/Downloads/festival/speech_tools/lib/libestools.a /home/joshua/Downloads/festival/speech_tools/lib/libeststring.a
我正在使用代码块,所以这是默认的构建命令
编辑2:将 -lncurses 添加到构建命令中消除了与 readline 相关的未定义引用错误,但其他错误仍然存在
/home/joshua/Downloads/festival/speech_tools/lib/libestools.a(EST_PST.o): In function `EST_PredictionSuffixTree::test(EST_String)':
EST_PST.cc:(.text+0x2d30): undefined reference to `confusion(EST_TKVL<EST_String, EST_String>&, EST_TList<EST_String>&)'
EST_PST.cc:(.text+0x2d40): undefined reference to `print_confusion(EST_FMatrix const&, EST_TKVL<EST_String, EST_String>&, EST_TList<EST_String>&)'
/home/joshua/Downloads/festival/speech_tools/lib/libestools.a(wfst_ops.o): In function `EST_WFST::determinize(EST_WFST const&)':
wfst_ops.cc:(.text+0x1136): undefined reference to `EST_THash<int, int>::EST_THash(int, unsigned int (*)(int const&, unsigned int))'
wfst_ops.cc:(.text+0x1206): undefined reference to `EST_THash<int, int>::val(int const&, int&) const'
wfst_ops.cc:(.text+0x122f): undefined reference to `EST_THash<int, int>::add_item(int const&, int const&, int)'
wfst_ops.cc:(.text+0x1568): undefined reference to `EST_THash<int, int>::~EST_THash()'
wfst_ops.cc:(.text+0x17d8): undefined reference to `EST_THash<int, int>::~EST_THash()'
编辑3:将 libestbase 设置为上次链接修复了错误。
它可能与此错误报告有关:https://bugzilla.redhat.com/show_bug.cgi?id=499837
它建议您在 ncurses 库中显式链接似乎由您的另一个库包含的阅读行库。所以你会添加:
-lncurses
到你的命令。
相关文章:
- GTest EXPECT_EQ给出未定义的错误参考
- 在VSCode中编译C++给了我一个未定义的参考
- Armadillo正在为共享的lapack库获取未定义的参考
- 我对C++程序有一个未定义的参考,不知道如何处理它
- 使用Arduino IDE的构造函数的未定义参考错误
- 在C++中使用 CImg 的未定义参考错误
- gtest的未定义参考
- 未定义参考 cv::鱼眼::校准
- WEBRTC的未定义参考
- 如何编译ZBAR示例?(未定义参考..)
- 针对C 库链接时的未定义参考
- 命名空间外部变量的未定义参考/多重定义,C 结构问题
- 简单QT程序中的未定义参考
- 主要makefile中的未定义参考
- C 标题中的外部变量的未定义参考
- 对[class::function]的未定义引用/对[class]的typeinfo的未定义参考
- icu 54-未定义参考
- 信号上的QT未定义参考编译错误
- boost 1.58未定义参考
- QT未定义参考错误(Qextserialport)