痛饮jni问题
我正在尝试对我的“.c”文件使用 swig 工具。
我运行以下命令,
$swig -java example.i $gcc -c example.c example_wrap.c -I/c/jdk1.3.1/include -I/c/jdk1.3.1/include/win32
然后出现以下错误。
example_wrap.c:135:17: error: jni.h: No such file or directory example_wrap.c:159: error: expected ‘)’ before ‘*’ token example_wrap.c:201: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Java_exampleJNI_My_1variable_1set’ example_wrap.c:211: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JNICALL’ example_wrap.c:223: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JNICALL’ example_wrap.c:237: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JNICALL’ example_wrap.c:253: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JNICALL’
jni.h
将位于何处。以及我如何指定包含它的路径。
I am trying to use swig tool for my ".c" files.
i run the following commands ,
$swig -java example.i $gcc -c example.c example_wrap.c -I/c/jdk1.3.1/include -I/c/jdk1.3.1/include/win32
Then i got the following error.
example_wrap.c:135:17: error: jni.h: No such file or directory example_wrap.c:159: error: expected ‘)’ before ‘*’ token example_wrap.c:201: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Java_exampleJNI_My_1variable_1set’ example_wrap.c:211: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JNICALL’ example_wrap.c:223: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JNICALL’ example_wrap.c:237: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JNICALL’ example_wrap.c:253: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘JNICALL’
where will be jni.h
will be located. and how do i specify the path to include that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你真的在使用 JDK 1.3 吗?那是一个相当旧的版本。
在我的系统上,它位于: /usr/lib/jvm/java-6-sun-1.6.0.20/include/jni.h 因此,我认为您已经完成的操作应该足够了。 ..也许这个旧的 JDK 或者你的安装有问题?
Are you really using JDK 1.3? that is a pretty old version.
On my system its located: /usr/lib/jvm/java-6-sun-1.6.0.20/include/jni.h So I would think what you've already done with should be enough... Maybe there is some issue with either this older JDK, or your install?