首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >基本节日程序存在未定义的引用错误

基本节日程序存在未定义的引用错误
EN

Stack Overflow用户
提问于 2017-11-14 03:59:21
回答 1查看 345关注 0票数 0

我目前正在尝试编译这个基本的节日程序。

代码语言:javascript
复制
#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++构建程序时,我得到了以下错误:

代码语言:javascript
复制
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,我在搜索路径中添加了节/src/include和speech_tools/include,此外还链接了节/src/lib/libFestival.a、speech_tools/lib/lib/libestools.a、speech_tools/lib/liestbase.a和speech_tools/lib/libstring.a。

我正在尝试在Arch Linux上使用g++和节日2.4.0来构建它。

编辑:我使用的Build命令是

代码语言:javascript
复制
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

我使用的是CodeBlocks,所以这是默认的构建命令

编辑2:向构建命令添加-lncurses消除了与readline相关的未定义引用错误,但其他错误仍然存在

代码语言:javascript
复制
/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设置为link last修复了这个错误。

EN

回答 1

Stack Overflow用户

发布于 2017-11-14 04:39:52

它可能与这个错误报告有关:https://bugzilla.redhat.com/show_bug.cgi?id=499837

它建议您显式地链接到ncurses库中,用于似乎包含在另一个库中的readline库。因此,您可以添加:

代码语言:javascript
复制
-lncurses

你的命令。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47272529

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档