我正在尝试构建一个使用SWIG创建的包装器。当我尝试构建文件时,我收到一条错误消息,指出找不到jni.h。我有使用-I标志指定的正确路径但它仍然无法找到它。我正在使用cygwin在windows上构建。我做错了什么?
$ 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)
答案 0 :(得分:1)
好的,我弄清楚出了什么问题。除了将/ cygdrive /添加到路径的前面(感谢@krsteeve),我需要将“/ Program Files \(x86 \)/”更改为“/ Program Files(x86)/”。我第一次试用它没有'\'它抱怨我,但现在它正在工作。完整的工作命令如下:
$ 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"