我是菜鸟,我在生成*.dll的时候,我先创建一个*.dll 工程,我有两个文件一个 Dll.cpp
代码如下:
#include <StubPreamble.h>
#include "NativeDemo.h"
#include <stdio.h>JNIEXPORT jint JNICALL Java_NativeDemo_test(JNIEnv *, jobject)
{
printf("hello:!\n");
printf("this is in the native method!\n");
}另一个文件是 NativeDemo.h/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class NativeDemo */#ifndef _Included_NativeDemo
#define _Included_NativeDemo
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: NativeDemo
* Method: test
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_NativeDemo_test
(JNIEnv *, jobject);#ifdef __cplusplus
}
#endif
#endif
我把这两个文件都包含进去的时候,却出现如下提示:
unexpected end of file while looking for precompiled header directive。
请问原因何在?
代码如下:
#include <StubPreamble.h>
#include "NativeDemo.h"
#include <stdio.h>JNIEXPORT jint JNICALL Java_NativeDemo_test(JNIEnv *, jobject)
{
printf("hello:!\n");
printf("this is in the native method!\n");
}另一个文件是 NativeDemo.h/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class NativeDemo */#ifndef _Included_NativeDemo
#define _Included_NativeDemo
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: NativeDemo
* Method: test
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_NativeDemo_test
(JNIEnv *, jobject);#ifdef __cplusplus
}
#endif
#endif
我把这两个文件都包含进去的时候,却出现如下提示:
unexpected end of file while looking for precompiled header directive。
请问原因何在?
Setting ->C++ ->Category: precomplied header里设置成不用预编译头文件