-1
予編譯使用MinGW的BITMAPFILEHEADER未鏈接?
C:\MinGW64\mingw64\bin\g++ -shared
-IC:\Progra~1\Java\jdk1.7.0_10\include
-IC:\Progra~1\Java\jdk1.7.0_10\include\win32
test.h -o test.dll
確定的c程序。此代碼編譯並運行良好:
JNIEXPORT void JNICALL Java_Bar_doFoo (JNIEnv *env, jobject o){
printf("hi!");
}
輸出爲hi!
。
此代碼編譯良好,但不運行。
JNIEXPORT void JNICALL Java_Bar_doFoo (JNIEnv *env, jobject o){
printf("hi!");
BITMAPFILEHEADER bmpFileHeader;
}
的例外是:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Peter\Documents\workspace\Bar\foo.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at Run.<init>(Run.java:17)
at Run.<clinit>(Run.java:14)
at Run.main(Run.java:9)
我想我需要連接更多一些。任何想法?我可以通過使用LoadLibrary("*.dll")
嗎?