我得到一個編譯錯誤的下面的頭文件:C++爲JNI編譯錯誤:未知類型名稱的JNIEnv jint JavaVM的
#include <jni.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
jint x1;
jint y1;
jint x2;
jint y2;
} Bounds;
...
#ifdef __cplusplus
};
#endif
還有其他的JNI引用,如jobject
,JNIEnv
,JavaVM
,等 這並不是抱怨,< jni.h頭缺失(這是,但很容易通過添加包含路徑修復)。我已經檢查過頭文件,並在頭文件中定義了類型(也是< jni_md.h>)。
這對我沒有任何意義。有任何想法嗎?
編輯:我忘了包括以下錯誤文本。
g++ -O2 -fPIC -fpermissive -I. -I.. -I/usr/include -I/usr/local/include/libavcodec -I/usr/local/include/libavdevice -I/usr/local/include/libavformat -I/usr/local/include/libswscale -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -DUNIX -shared -c -o Plugin.o Plugin.cpp
clang: warning: argument unused during compilation: '-shared'
In file included from Plugin.cpp:19:
In file included from Plugin.h:16:
Data.h:24:5: error: unknown type name 'jint'
jint x1;
^
Data.h:25:5: error: unknown type name 'jint'
jint y1;
^
Data.h:26:5: error: unknown type name 'jint'
jint x2;
^
Data.h:27:5: error: unknown type name 'jint'
jint y2;
^
請您提供完整的錯誤文字嗎? – Leon
可能 - 請參閱http://stackoverflow.com/questions/7212982/ –
@ZabojCampula就像我說的,我沒有找到標題的問題,他們被包括在內。 –