无法启动程序.Pocketsphinx.dll 丢失错误 [英] Cannot start program. Pocketsphinx.dll is missing error

查看:24
本文介绍了无法启动程序.Pocketsphinx.dll 丢失错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了要在 Visual Studio 中使用的其他库目录和 lib 文件夹.构建也成功了,但是每当我尝试从 Visual Studio 执行程序时,它都会返回以下错误:

I have set additional library directories and lib folders to be used in visual studio. Also build succeeded but whenever I try to execute the program from Visual Studio it returns the following error:

该程序无法启动,因为您的计算机缺少 pvc.dll.尝试重新安装程序以解决问题.

The program can't start because pocketsphinx.dll is missing from your computer. Try reinstalling the program to fix problem.

当我检查目录时,我看到 pocketsphinx.dll 在那里.

When I checked the directories, I saw that pocketsphinx.dll was there.

我的代码是(取自 pocketsphinx wikia):

My code is (taken from pocketsphinx wikia):

#include <pocketsphinx.h>

#define MODELDIR "C:\Sphinx\pocketsphinx\model" 
int
main(int argc, char *argv[])
{
ps_decoder_t *ps;
cmd_ln_t *config;
FILE *fh;
char const *hyp, *uttid;
int16 buf[512];
int rv;
int32 score;

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);
if (config == NULL) {
    fprintf(stderr, "Failed to create config object, see log for details\n");
    return -1;
}

ps = ps_init(config);
if (ps == NULL) {
    fprintf(stderr, "Failed to create recognizer, see log for details\n");
    return -1;
}

fh = fopen("goforward.raw", "rb");
if (fh == NULL) {
    fprintf(stderr, "Unable to open input file goforward.raw\n");
    return -1;
}

rv = ps_start_utt(ps);

while (!feof(fh)) {
    size_t nsamp;
    nsamp = fread(buf, 2, 512, fh);
    rv = ps_process_raw(ps, buf, nsamp, FALSE, FALSE);
}

rv = ps_end_utt(ps);
hyp = ps_get_hyp(ps, &score);
printf("Recognized: %s\n", hyp);

fclose(fh);
ps_free(ps);
cmd_ln_free_r(config);

return 0;
}

pocketsphinx.dllpocketsphinx.lib 一样位于 bin\Debug\x64 文件夹中.

pocketsphinx.dll is in bin\Debug\x64 folder as like as pocketsphinx.lib.

推荐答案

当您在 Visual Studio 的调试器中运行您的程序时,您的工作目录参数(项目设置->配置属性->调试)是 $(ProjectDir) 默认情况下.将其更改为 $(TargetDir) 并且它应该开始.

When you run your program in a debugger in Visual Studio your Working Directory parameter (Project Settings->Configuration Properties->Debugging) is $(ProjectDir) by default. Change it to $(TargetDir) and it should start.

这篇关于无法启动程序.Pocketsphinx.dll 丢失错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆