JNI:vcvars32.bat给我“无法打开包含文件:'stdio.h':没有这样的文件或目录" [英] JNI: vcvars32.bat gives me "Cannot open include file: 'stdio.h': No such file or directory"
问题描述
我正在尝试使用JNI将.C代码与我的Java项目集成.
I am trying to use JNI to integrate a .C code with my Java project.
在Visual Studio 2017中尝试使用vcvars32.bat生成.dll文件时,它给了我一条错误消息,提示:
While trying to generate the .dll file using vcvars32.bat in visual studio 2017 it gives me an error message tells:
"C:\ Program Files \ Java \ jdk1.8.0_151 \ include \ jni.h(39):致命错误C1083:无法打开包含文件:'stdio.h':没有这样的文件或目录"
"C:\Program Files\Java\jdk1.8.0_151\include\jni.h(39): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory"
我在我的C代码中删除了stdio.h库的内容,但这没有帮助.
I removed the including of stdio.h library in my C code but it didn't help.
我的命令是:
"cl -I" C:\ Program Files \ Java \ jdk1.8.0_151 \ include"-I" C:\ Program Files \ Java \ jdk1.8.0_151 \ include \ win32"-LD" Factorial.c"-Fe"Factorial.dll""
"cl -I"C:\Program Files\Java\jdk1.8.0_151\include" -I"C:\Program Files\Java\jdk1.8.0_151\include\win32" -LD "Factorial.c" -Fe"Factorial.dll""
推荐答案
经过一段时间的搜索和失败后,我不得不通过VS13 vsvars32.bat生成它,请注意,vsvars不是生成17位dll的VS17的vcvars,因为我的平台是我必须安装64位并切换到32位JVM,问题已解决.
After sometime of searching and failing I had to generate it by VS13 vsvars32.bat note that vsvars not VS17's vcvars that generated 32-bit dll and because my platform is 64-bit I had to install and switch to 32-bit JVM and problem is resolved.
这篇关于JNI:vcvars32.bat给我“无法打开包含文件:'stdio.h':没有这样的文件或目录"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!