0

该项目是关于与 java 握手 Cpp 为此我使用 JNI,我进行了所有必要的配置,使 Cpp 项目在 Cpp 项目的 src 文件夹中生成头文件创建 ABC.h 文件和 abc.Cpp 文件。当我构建 abc.cpp 文件时,它显示错误编译失败,因为 p.thread 没有找到这样的目录,如果我删除这个 P.thread 头文件,它显示 ABC.h 未找到,而 ABC.h 文件在同一个文件夹中,我们包括在我们的 Cpp 文件中请帮助我解决这个问题,我是 JNI 的新手,下面附加的 PNG 文件向您展示了详细信息

ERROR ON ECLIPSE CONSOLE//////////////////////////////////////////

00:31:21 **** Incremental Build of configuration Default for project SyntacJNI ****
Info: Internal Builder is used for build
g++ "-IC:\\Program Files\\Java\\jdk1.7.0_21\\include\\win32" "-IC:\\Program Files\\Java\\jdk1.7.0_21\\include" -O2 -g -Wall -c -fmessage-length=0 -o "src\\abc
.o" "..\\src\\abc.cpp" 
..\src\abc.cpp:10:21: fatal error:abc.h: No such file or directory
 #include <pthread.h>
                     ^
compilation terminated.

00:31:21 Build Finished (took 189ms)

///////////////////////////abc.cpp//////////////CODE Snippet////////////////////////

    #include <fstream>
    #include <unistd.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <pthread.h>
    #include <string.h>
    #include <windows.h>
    #include <SyntacInterface.h>
    #include <org_syntec_ivb_jni_DeviceCommunicationController.h>

    using namespace std;

    // An unsigned char can store 1 Bytes (8bits) of data (0-255)
    typedef unsigned char BYTE;
    // Global Var

    bool gLive_View = true;
    // Get the size of a file

    #include <stdlib.h>
    ULONG RcvdBytes;
    volatile bool keepRunning = false;
    volatile bool modeFlag = true;
    static HANDLE hThread = NULL;
    int compstr = 0xFF000F00;
    long int count = 0;
    static void run();
    static void end();
    static DWORD WINAPI ThreadProc(LPVOID lpParam);
    static ULONG BuffSizeLive = 81408;
    //CRITICAL_SECTION critical;
    int got = 0;

    static void run() {
        DWORD dummy;
        hThread = CreateThread(NULL, 0, ThreadProc, NULL, 0, &dummy);
    }
    static void end() {
        keepRunning = false;
        CloseHandle(hThread);
    }
    bool fexists(const char *filename) {
        ifstream ifile(filename);
        return ifile.good();
    }

    static DWORD WINAPI ThreadProc(LPVOID lpParam) {
        while (keepRunning) {

            BuffSizeLive = 327680;

            UCHAR* Buff = (UCHAR*) malloc(sizeof(UCHAR) * BuffSizeLive);

            ULONG RcvdBytes;
            RcvdBytes = abc_GetCapture(Buff, BuffSizeLive);
            if (RcvdBytes == 327680 || RcvdBytes == 81408) {

                Syntac_WriteToBinaryFile(Buff,
                        "C:/listenDir/Capture_Mod1.BIN", RcvdBytes);
            }
            free(Buff);
            cout << "got the frame stream " << got;
        }
        return 0;
    }][1]
4

0 回答 0