如何修复 fatal error jvmti.h No such file or directory compilation terminated c code ubuntu?我的 C 代码是:
包含“jvmti.h”
JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
/* 我们返回 JNI_OK 表示成功 */ printf("\n我的名字是,\n\n");
返回JNI_OK;
JNIEXPORT 无效 JNICALL Agent_OnUnload(JavaVM *vm) {
在终端中键入此命令:gcc -Wall -W -Werror first_agent.c -o firstagent
first_agent.c:1:19: fatal error: jvmti.h: No such file or directory compilation terminated.
其中java jdk版本 javac 1.7.0_25
其中gcc版本gcc版本4.7.3(Ubuntu/Linaro 4.7.3-2ubuntu4)
这里应该把gcc版本更新到4.8?
最佳答案
这个问题现在已经很老了,但将来可能有人会偶然发现这个问题。
正如@Gyro Gearless 已经提到的,您需要指定“包含目录”。
对于 Ubuntu 15.04 上的 Java 8,我在以下位置找到了文件夹
- /usr/lib/jvm/java-1.8.0-openjdk-amd64/include
- /usr/lib/jvm/java-1.8.0-openjdk-amd64/include/linux
在此目录中,您可以找到以下头文件:
- 类文件_常量.h
- jawt.h
- jdwpTransport.h
- jni.h
- jvmticmlr.h
- jvmti.h
编译器需要包含哪些内容。
关于java - 如何修复 fatal error jvmti.h No such file or directory compilation terminated c code ubuntu?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19587473/