我正在尝试使用voce语音识别API的C ++版本。它是一个用Java构建的API,同时也支持C ++。但是,每当我尝试执行它时,我都会收到错误
C:\Users\yohan\Documents\Extra C++ Libs\Voice Recognition - Voce API\voce-0.9.1\src\c++\voce.h:34: error: C1083: Cannot open include file: 'jni.h': No such file or directory
这是我的.pro内容
#-------------------------------------------------
#
# Project created by QtCreator 2013-04-26T12:59:05
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = Tired
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += C:/opencv/build/include
INCLUDEPATH += C:/opencv/build/include/opencv
INCLUDEPATH += C:/Program Files/Java/jdk1.7.0/include/
INCLUDEPATH += C:/Program Files/Java/jdk1.7.0/include/win32
LIBS += C:/opencv/build/x86/vc9/lib/opencv_calib3d240.lib
LIBS += C:/opencv/build/x86/vc9/lib/opencv_contrib240.lib
LIBS += C:/opencv/build/x86/vc9/lib/opencv_core240.lib
LIBS += C:/opencv/build/x86/vc9/lib/opencv_features2d240.lib
LIBS += C:/opencv/build/x86/vc9/lib/opencv_flann240.lib
LIBS += C:/opencv/build/x86/vc9/lib/opencv_highgui240.lib
LIBS += C:/opencv/build/x86/vc9/lib/opencv_imgproc240.lib
LIBS += C:/opencv/build/x86/vc9/lib/opencv_objdetect240.lib
LIBS += C:/opencv/build/x86/vc9/lib/opencv_video240.lib
HEADERS +=
这是 Main.cpp
的代码#include "C:/Users/yohan/Documents/Extra C++ Libs/Voice Recognition - Voce API/voce-0.9.1/src/c++/voce.h"
int main()
{
}
voce.h 代码的一小部分在下面给出
#ifndef VOCE_H
#define VOCE_H
// This file contains a C++ interface for Voce's Java functions. All of
// the Java methods in Voce's API are instance methods, so we don't need
// to handle class methods here. For documentation on the specific
// functions, refer to the API documentation for the Java source.
#include <jni.h>
#include <iostream>
#include <string>
/// The namespace containing everything in the Voce C++ API.
namespace voce
{
#ifdef WIN32
const std::string pathSeparator = ";";
#else
const std::string pathSeparator = ":";
#endif
/// Contains things that should only be accessed within Voce.
namespace internal
{
/// Global instance of the JNI environment.
JNIEnv* gEnv = NULL;
/// Global instance of the Java virtual machine.
JavaVM *gJVM = NULL;
//Code Continues..........................................
如何摆脱这个错误?我正在使用QT,这是使用Visual Studio 2010编译器的最新版本。
请帮忙!
答案 0 :(得分:9)
您应该引用包含空格的INCLUDEPATH部分。而不是做:
INCLUDEPATH += C:/Program Files/Java/jdk1.7.0/include/
INCLUDEPATH += C:/Program Files/Java/jdk1.7.0/include/win32
你可能应该这样做:
INCLUDEPATH += "C:/Program Files/Java/jdk1.7.0/include/"
INCLUDEPATH += "C:/Program Files/Java/jdk1.7.0/include/win32"