我正在研究一個基本的應用程序來創建一個Java VM,並使用JNI從C++啓動一個Java程序。但是,我有一些編譯錯誤:Visual C++錯誤:LNK2019,LNK2028和LNK1120
Error 6 error LNK2028: unresolved token (0A00000D) "extern "C" long __stdcall JNI_CreateJavaVM(struct JavaVM_ * *,void * *,void *)" ([email protected]@[email protected]@[email protected]) referenced in function "public: bool __clrcall JarLauncher::launchJar(void)" ([email protected]@@$$FQ$AAM_NXZ)
Error 5 error LNK2028: unresolved token (0A00000C) "extern "C" long __stdcall JNI_GetDefaultJavaVMInitArgs(void *)" ([email protected]@[email protected]) referenced in function "public: bool __clrcall JarLauncher::launchJar(void)" ([email protected]@@$$FQ$AAM_NXZ)
Error 7 error LNK2019: unresolved external symbol "extern "C" long __stdcall JNI_GetDefaultJavaVMInitArgs(void *)" ([email protected]@[email protected]) referenced in function "public: bool __clrcall JarLauncher::launchJar(void)" ([email protected]@@$$FQ$AAM_NXZ)
Error 8 error LNK2019: unresolved external symbol "extern "C" long __stdcall JNI_CreateJavaVM(struct JavaVM_ * *,void * *,void *)" ([email protected]@[email protected]@[email protected]) referenced in function "public: bool __clrcall JarLauncher::launchJar(void)" ([email protected]@@$$FQ$AAM_NXZ)
Error 9 error LNK1120: 4 unresolved externals
任何幫助嗎?
這些是鏈接器錯誤,而不是編譯器錯誤。它告訴你你錯過了一些符號。你或者需要提供實現或者爲圖書館獲取它們。 –
似乎你忘了鏈接圖書館這兩個函數reisde。 –
JDK提供了兩個連接到鏈接器的.lib文件。我附加了jvm.lib和jawt.lib(儘管我可能不需要後者) – Klayderpus