我在做一个JNI练习的时候,生成动态连接库文件报错。。如下
D:\java\text>cl -Ic:\progra~1\Java\jdk1.6.0_01\include -Ic:\progra~1\Java\jdk1.6
.0_01\include\win32 -LD HelloWorldImp.c -Fehello.dll
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.HelloWorldImp.c
c:\progra~1\Java\jdk1.6.0_01\include\jni.h(21) : fatal error C1083: Cannot open
include file: 'stdio.h': No such file or directory
但是VC的INCLUDE目录下有stdio.h文件啊。。??????????

解决方案 »

  1.   

    我对 cl 的命令行方式不熟。你这样的写法能把 VC 的 INCLUDE 目录包含进来吗?
      

  2.   

    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
    Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
    =========================================
    MS楼主用的VC++6.0里面的编译器。……楼主可以试下使用C++编写。HelloWorldImp.c改名成HelloWorldImp.cpp;把里面的
    #include <stdio.h>
    换成:
    #include <cstdio>
    // 其他头文件
    using namespace std;// 其他代码其他的C风格的头文件也换成C++风格。我这里倒是有JNI简单的成功例子。楼主感兴趣的话可以发给你,我邮箱:[email protected]。Good Luck!^_^!
      

  3.   

    > 有吧。。都是照着演示和书写的。。想起一个问题。VC++ 在用命令行做编译连接的时候,可以用环境变量来设置 INCLUDE 和 LIB 路径。安装 VC++ 的时候会有一个批处理文件帮你设置这些环境变量,应该在 C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT。你应该先运行这个批处理文件,然后再运行 cl 命令行。
      

  4.   

    VCVARS32运行过了。。环境变量也设置好了