该项目是关于使用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]