痛饮jni问题

发布于 2024-09-04 21:15:32 字数 873 浏览 4 评论 0原文

我正在尝试对我的“.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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雪化雨蝶 2024-09-11 21:15:32

你真的在使用 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文