简体   繁体   English

jni.h:不包含这样的文件或目录,包括路径

[英]jni.h: No such file or directory, path is included

I am trying to build a wrapper that I created using SWIG. 我正在尝试构建使用SWIG创建的包装器。 When I try to build the file I get an error saying that jni.h is not found. 当我尝试构建文件时,出现错误消息,提示找不到jni.h。 I have the correct path to it specified with the -I flag but it still cannot find it. 我有使用-I标志指定的正确路径,但仍然找不到它。 I am building on windows using cygwin. 我正在使用cygwin在Windows上构建。 What am I doing wrong? 我究竟做错了什么?

$ gcc -c zinnia_wrap.c -I "/C/Program Files \( x86\)/Java/jdk1.6.0_23/include"
-I "/C/Program Files \(x86\)/Java/jdk.1.6.0_23/include/win32"
zinnia_wrap.c:135:17: jni.h: No such file or directory
zinnia_wrap.c:159: error: parse error before '*' token
zinnia_wrap.c: In function `SWIG_JavaThrowException':
zinnia_wrap.c:160: error: `jclass' undeclared (first use in this function)
zinnia_wrap.c:160: error: (Each undeclared identifier is reported only once
zinnia_wrap.c:160: error: for each function it appears in.)
zinnia_wrap.c:160: error: parse error before "excep"
zinnia_wrap.c:175: error: `code' undeclared (first use in this function)
zinnia_wrap.c:178: error: `jenv' undeclared (first use in this function)
zinnia_wrap.c:179: error: `excep' undeclared (first use in this function)
zinnia_wrap.c:181: error: `msg' undeclared (first use in this function)

Ok so I figured out what was wrong. 好的,所以我找出了问题所在。 In addition to adding /cygdrive/ to the front of the path (thanks @krsteeve) I needed to change "/Program Files \\(x86\\)/" to "/Program Files (x86)/". 除了将/ cygdrive /添加到路径的开头(感谢@krsteeve)之外,我还需要将“ / Program Files \\(x86 \\)/”更改为“ / Program Files(x86)/”。 The first time I tried it out without the '\\' it complained at me but now it is working. 我第一次尝试时没有出现“ \\”,但它抱怨我,但现在可以正常工作了。 The full working command is as follows: 完整的工作命令如下:

$ gcc -c zinnia_wrap.c -I "/cygdrive/c/Program Files (x86)/Java/jdk1.6.0_23/include" 
-I "/cygdrive/c/Program Files (x86)/Java/jdk1.6.0_23/include/win32"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM