具體錯誤:
/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);
如果找到了頭檔案,直接包含對應的頭檔案最好。