JNI: vcvars32.bat gives me “Cannot open include fi

2020-04-28 15:42发布

I am trying to use JNI to integrate a .C code with my Java project.

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): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory"

I removed the including of stdio.h library in my C code but it didn't help.

My command is:

"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""

1条回答
该账号已被封号
2楼-- · 2020-04-28 16:37

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.

查看更多
登录 后发表回答