【发布时间】:2017-04-04 00:48:20
【问题描述】:
我收到以下头文件的编译错误:
#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等。
它并没有抱怨缺少
这对我来说没有任何意义。有什么想法吗?
编辑:我忘记包含以下错误文本。
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;
^
【问题讨论】:
-
能否附上完整的错误文本?
-
@ZabojCampula 就像我说我在查找标题时没有问题,它们被包含在内。
-
@GuyKogus:好的,所以我重复 Leon 的问题:编译器错误到底是什么?
-
尝试使用选项
-E进行编译以查看预处理器结果。也许你在那里找到了提示。可能是标题位于与您预期不同的位置或其他位置。顺便说一句,您使用clang还是gcc?命令行包含命令g++,但警告看起来像来自clang。
标签: c++ java-native-interface g++