创建.so库致命错误...... .h没有这样的文件或目录

时间:2012-06-17 12:52:47

标签: gcc java-native-interface

comrade@hp:~/workspace/JNI2/src$ ls
Prompt.c  Prompt.class  Prompt.h  Prompt.java

comrade@hp:~/workspace/JNI2/src$ gcc --shared -o libPrompt.so -I/usr/lib/jvm/java-6-openjdk-i386/include -I/usr/lib/jvm/java-6-openjdk-i386/include/linux -lX11 Prompt.c /usr/lib/jvm/java-6-openjdk-i386/jre/lib/i386/server/libjvm.so
Prompt.c:2:20: fatal error: Prompt.h: No such file or directory
compilation terminated.


Prompt.c :  
#include <jni.h>
#include <Prompt.h>
........

我不明白的是什么?

1 个答案:

答案 0 :(得分:1)

如评论所述,请更改为:

#include "Prompt.h"

来自The #include directive

#include <file>
    This variant is used for system header files.
    It searches for a file named file in a list of directories
    specified by you, then in a standard list of system directories.
    You specify directories to search for header files with the
    command option `-I' (see section 1.9 Invoking the C Preprocessor).
    The option `-nostdinc' inhibits searching the standard system
    directories; in this case only the directories you specify are searched.

#include "file"
    This variant is used for header files of your own program.
    It searches for a file named file first in the current directory,
    then in the same directories used for system header files.
    The current directory is the directory of the current input file.
    It is tried first because it is presumed to be the location of the
    files that the current input file refers to.
    (If the `-I-' option is used, the special treatment of the
     current directory is inhibited.)