语音程序没有输出和错误
No output and no errors from Voce program
我正在使用 voice 语音识别API,这是为Java和c++构建的。下面是我的代码
#include "C:/Users/yohan/Documents/voce-0.9.1/src/c++/voce.h"
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
voce::init("C:/Users/yohan/Documents/voce-0.9.1/lib", true, false, "", "");
voce::synthesize("This is a speech synthesis test.");
voce::synthesize("Type a message to hear it spoken aloud.");
std::cout << "This is a speech synthesis test. "
<< "Type a message to hear it spoken aloud." << std::endl;
std::cout << "Type 's' + 'enter' to make the "
<< "synthesizer stop speaking. Type 'q' + 'enter' to quit."
<< std::endl;
std::string s;
while (s != "q")
{
// Read a line from keyboard.
std::getline(std::cin, s);
if ("s" == s)
{
voce::stopSynthesizing();
}
else
{
// Speak what was typed.
voce::synthesize(s);
}
}
voce::destroy();
// system("pause");
return 0;
}
当我运行这段代码时,我一无所获。没有错误,没有输出,只是控制台窗口打开并说"按return to exit";这就是全部。以下是在QT控制台
中打印的消息Starting C:UsersyohanDocumentsQTPeojectsTired-build-Desktop_Qt_5_0_0_beta2_MSVC2010_32bit_SDK-ReleasereleaseTired.exe...
C:UsersyohanDocumentsQTPeojectsTired-build-Desktop_Qt_5_0_0_beta2_MSVC2010_32bit_SDK-ReleasereleaseTired.exe exited with code 0
voice .h是一个API文件,你可以从这里获得它。这个头文件使用Jni,将Java代码转换为c++。http://sourceforge.net/p/voce/code/HEAD/tree/src/c + +/
尝试在调试器中运行它。main中的第一行可能失败,当失败时只调用exit(0)。在它上面也放一条调试语句。
好运。希望对你有帮助。
编辑:还要确保对库调用进行适当的错误检查。有时这需要try
catch
块,或者其他时候,只检查函数调用的返回值。
相关文章:
- 显示错误输出的简单数组排序程序
- Dijkstra 中的错误输出
- 自定义runtime_error,如果我在 #what 中使用#c_str(),则错误输出始终为空
- 流字符串错误输出
- C++ 异常处理错误输出
- C ++中的错误输出,i = 65530,当我们打印i的值时,它给出-6状态65530
- SSE和iostream:浮点类型的错误输出
- C++将 popen 错误输出读取为字符串
- 部分透视/高斯消除 - 交换列而不是产生错误输出的行
- C++,向量:获得包含 0 的错误输出
- 数组函数错误输出
- CC1plus 错误:输出文件名指定两次
- 字符串错误输出
- 子斯特的错误输出
- 对大量c++错误输出完全一无所知.我认为这与预定义的函数和迭代器有关
- 简单程序的错误输出
- XCode调试器lldb中断,没有错误输出,但程序运行良好
- std::string::append(std::string)错误输出
- 查看大错误输出的顶行
- 使用结构的错误输出