无法打开包含文件:'jni。h':没有这样的文件或目录

时间:2021-01-28 15:06:20

I am trying to use the C++ version of voce voice recognition API. It is an API built in Java, with support to C++ as well. However, whenever I am trying to execute it, I am getting the error

我正在尝试使用c++版本的voce语音识别API。它是一个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

This is my .pro content

这是我的。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 +=

This is the code for Main.cpp

这是Main.cpp的代码

#include "C:/Users/yohan/Documents/Extra C++ Libs/Voice Recognition - Voce API/voce-0.9.1/src/c++/voce.h"

int main()
{


}

A small part of the code of voce.h is given below

这是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..........................................

How can I get rid of this error? I am using QT, the latest version which use the Visual Studio 2010 compiler.

我怎么才能摆脱这个错误呢?我正在使用QT,这是使用Visual Studio 2010编译器的最新版本。

Please help!

请帮助!

1 个解决方案

#1


8  

You should quote the parts of the INCLUDEPATH that contain spaces. Instead of doing:

你应该引用包含空格的include部分。而不是做:

INCLUDEPATH += C:/Program Files/Java/jdk1.7.0/include/
INCLUDEPATH += C:/Program Files/Java/jdk1.7.0/include/win32

You should probably be doing:

你应该这样做:

INCLUDEPATH += "C:/Program Files/Java/jdk1.7.0/include/"
INCLUDEPATH += "C:/Program Files/Java/jdk1.7.0/include/win32"

#1


8  

You should quote the parts of the INCLUDEPATH that contain spaces. Instead of doing:

你应该引用包含空格的include部分。而不是做:

INCLUDEPATH += C:/Program Files/Java/jdk1.7.0/include/
INCLUDEPATH += C:/Program Files/Java/jdk1.7.0/include/win32

You should probably be doing:

你应该这样做:

INCLUDEPATH += "C:/Program Files/Java/jdk1.7.0/include/"
INCLUDEPATH += "C:/Program Files/Java/jdk1.7.0/include/win32"