具体错误:
/Users/tsit/tsjdk8-project/openjdk8/jdk/src/share/native/sun/misc/URLClassPath.c:58:5: error: implicit declaration of function 'VerifyFixClassname' is invalid in C99 [-Werror,-Wimplicit-function-declaration] VerifyFixClassname(clname); ^ /Users/tsit/tsjdk8-project/openjdk8/jdk/src/share/native/sun/misc/URLClassPath.c:60:10: error: implicit declaration of function 'VerifyClassname' is invalid in C99 [-Werror,-Wimplicit-function-declaration] if (!VerifyClassname(clname, JNI_TRUE)) { /* expects slashed name */ ^ /Users/tsit/tsjdk8-project/openjdk8/jdk/src/share/native/sun/misc/URLClassPath.c:60:10: note: did you mean 'VerifyFixClassname'? /Users/tsit/tsjdk8-project/openjdk8/jdk/src/share/native/sun/misc/URLClassPath.c:58:5: note: 'VerifyFixClassname' declared here VerifyFixClassname(clname); ^
2 errors generated.
解决办法:
原因就是没有include头文件。最简单办法就是来个外部声明:
extern jboolean VerifyFixClassname(char* name); extern jboolean VerifyClassname(char* name, jboolean allowArrayClass);
如果找到了头文件,直接包含对应的头文件最好。