标签:des style blog color io java ar strong for
万能的博客园啊……希望发完这个问题记录后能尽快发现自己的错误%>_<%
问题描述:
在linux下通过gcc命令编译c文件生成动态链接库.so文件时报错。之前命令内导入了jni.h和jni_md.h所在路径,报错;之后将这两个头文件复制到/usr/include/路径下,
导入,仍报错。
检查了一下JAVA_HOME路径、java、javac命令都能正常运行,普通的.c文件也能正常编译。根据报错的提示来看是.h文件中的jint、jbyte...未定义。。。不过根据我
浅薄的认知,这些变量不就在jni.h里定义的么……真是头痛。。。
anna@ubuntu:~/Documents/temp$ gcc -shared -I /usr/include/ JniTest.c -o libHello.so In file included from /usr/include/jni_md.h:32:0, from /usr/include/jni.h:45, from JniTest.h:2, from JniTest.c:2: /usr/include/jawt.h:141:5: error: unknown type name ‘jint’ jint x; ^ /usr/include/jawt.h:142:5: error: unknown type name ‘jint’ jint y; ^ /usr/include/jawt.h:143:5: error: unknown type name ‘jint’ jint width; ^ /usr/include/jawt.h:144:5: error: unknown type name ‘jint’ jint height; ^ /usr/include/jawt.h:167:5: error: unknown type name ‘jint’ jint clipSize; ^ /usr/include/jawt.h:190:5: error: unknown type name ‘JNIEnv’ JNIEnv* env; ^ /usr/include/jawt.h:192:5: error: unknown type name ‘jobject’ jobject target; ^ /usr/include/jawt.h:208:5: error: expected specifier-qualifier-list before ‘jint’ jint (JNICALL *Lock) ^ /usr/include/jawt.h:242:5: error: unknown type name ‘jint’ jint version; ^ /usr/include/jawt.h:252:35: error: expected ‘)’ before ‘*’ token JAWT_DrawingSurface* (JNICALL *GetDrawingSurface) ^ /usr/include/jawt.h:257:19: error: expected ‘)’ before ‘*’ token void (JNICALL *FreeDrawingSurface) ^ /usr/include/jawt.h:263:19: error: expected ‘)’ before ‘*’ token void (JNICALL *Lock)(JNIEnv* env); ^ /usr/include/jawt.h:268:19: error: expected ‘)’ before ‘*’ token void (JNICALL *Unlock)(JNIEnv* env); ^ /usr/include/jawt.h:280:5: error: expected ‘;’ before ‘jobject’ jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo); ^ /usr/include/jawt.h:288:1: error: unknown type name ‘_JNI_IMPORT_OR_EXPORT_’ _JNI_IMPORT_OR_EXPORT_ ^ /usr/include/jawt.h:289:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JNICALL’ jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt); ^ /usr/include/jawt.h:289:10: error: unknown type name ‘JNICALL’ In file included from /usr/include/jni.h:45:0, from JniTest.h:2, from JniTest.c:2: /usr/include/jni_md.h:53:18: error: expected ‘)’ before ‘*’ token int (JNICALL *GetAWTColor)(JAWT_DrawingSurface* ds, ^ In file included from JniTest.h:2:0, from JniTest.c:2: /usr/include/jni.h:63:1: error: unknown type name ‘jint’ typedef jint jsize; ^ /usr/include/jni.h:122:5: error: unknown type name ‘jbyte’ jbyte b; ^ /usr/include/jni.h:125:5: error: unknown type name ‘jint’ jint i; ^ /usr/include/jni.h:126:5: error: unknown type name ‘jlong’ jlong j; ^ /usr/include/jni.h:220:5: error: expected specifier-qualifier-list before ‘jint’ jint (JNICALL *GetVersion)(JNIEnv *env); ^ /usr/include/jni.h:1869:5: error: unknown type name ‘jint’ jint version; ^ /usr/include/jni.h:1871:5: error: unknown type name ‘jint’ jint nOptions; ^ /usr/include/jni.h:1877:5: error: unknown type name ‘jint’ jint version; ^ /usr/include/jni.h:1895:5: error: expected specifier-qualifier-list before ‘jint’ jint (JNICALL *DestroyJavaVM)(JavaVM *vm); ^ /usr/include/jni.h:1934:1: error: unknown type name ‘JNIIMPORT’ _JNI_IMPORT_OR_EXPORT_ jint JNICALL ^ /usr/include/jni.h:1934:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JNICALL’ _JNI_IMPORT_OR_EXPORT_ jint JNICALL ^ /usr/include/jni.h:1934:29: error: unknown type name ‘JNICALL’ /usr/include/jni.h:1937:1: error: unknown type name ‘JNIIMPORT’ _JNI_IMPORT_OR_EXPORT_ jint JNICALL ^ /usr/include/jni.h:1937:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JNICALL’ _JNI_IMPORT_OR_EXPORT_ jint JNICALL ^ /usr/include/jni.h:1937:29: error: unknown type name ‘JNICALL’ /usr/include/jni.h:1940:1: error: unknown type name ‘JNIIMPORT’ _JNI_IMPORT_OR_EXPORT_ jint JNICALL ^ /usr/include/jni.h:1940:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JNICALL’ _JNI_IMPORT_OR_EXPORT_ jint JNICALL ^ /usr/include/jni.h:1940:29: error: unknown type name ‘JNICALL’ /usr/include/jni.h:1944:1: error: unknown type name ‘JNIEXPORT’ JNIEXPORT jint JNICALL ^ /usr/include/jni.h:1944:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JNICALL’ JNIEXPORT jint JNICALL ^ /usr/include/jni.h:1944:16: error: unknown type name ‘JNICALL’ /usr/include/jni.h:1947:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’ JNIEXPORT void JNICALL ^ In file included from JniTest.c:2:0: JniTest.h:15:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’ JNIEXPORT void JNICALL Java_JniTest_output ^ JniTest.c:4:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’ JNIEXPORT void JNICALL Java_JniTest_output(JNIEnv * env, jobject obj) ^
标签:des style blog color io java ar strong for
原文地址:http://www.cnblogs.com/annaivsu/p/3984672.html