未解决的符号构建pocketsphinx应用程序

时间:2016-07-25 21:21:47

标签: c ubuntu gedit pocketsphinx

我试图开始使用pocketsphinx,但是我收到了这个错误:

gcc -I /home/noahchalifour/libraries/pocketsphinx/include -I /home/noahchalifour/libraries/sphinxbase/include pocketsphinx.c -o pocketsphinx
/tmp/ccagvqgz.o: In function `main':
pocketsphinx.c:(.text+0x20): undefined reference to `ps_args'
pocketsphinx.c:(.text+0x6b): undefined reference to `cmd_ln_init'
collect2: error: ld returned 1 exit status

每次我运行此代码时:

#include <pocketsphinx.h>

#define MODELDIR "/home/libraries/pocketsphinx/model"

int main(int argc, char *argv[])
{
    ps_decoder_t *ps = NULL;
    cmd_ln_t *config = NULL;

    config = cmd_ln_init(NULL, ps_args(), TRUE,
             "-hmm", MODELDIR "/en-us/en-us",
             "-lm", MODELDIR "/en-us/en-us.lm.bin",
             "-dict", MODELDIR "/en-us/cmudict-en-us.dict",
             NULL);

    printf("Success!\n");

    return 0;
}

1 个答案:

答案 0 :(得分:1)

您还应该链接到pocketsphinx库:

gcc -I /home/noahchalifour/libraries/pocketsphinx/include \
    -I /home/noahchalifour/libraries/sphinxbase/include \
    -L /home/noahchalifour/libraries/pocketsphinx/lib \
    -L /home/noahchalifour/libraries/sphinxbase/lib \
    -lpocketsphinx -lsphinxbase -lsphinxad
    pocketsphinx.c -o pocketsphinx

我使用您为包含提供的前缀猜测libpocketphinx.solibsphinxbase.solibsphinxad.so的位置。