Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot open include file: 'jni.h': No such file or directory

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:\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

#-------------------------------------------------
#
# 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

#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

#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.

like image 448
PeakGen Avatar asked Dec 27 '22 04:12

PeakGen


1 Answers

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

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"
like image 142
spdaley Avatar answered Dec 29 '22 06:12

spdaley