Visual C++ Error: LNK2019, LNK2028 and LNK1120

后端 未结 1 1759
别跟我提以往
别跟我提以往 2021-01-25 11:40

I\'m working on a basic application to create a Java VM and launch a Java program from C++ with JNI. However, I have some compiling errors:

Error   6   error LNK         


        
相关标签:
1条回答
  • 2021-01-25 12:13

    It looks like you didn't link jvm.lib. You usually find it in %ProgramFiles%\Java\jdk1.X.XX_XX\lib, then you can add it to your linker input settings.

    Also, you'll need to load jvm.dll at runtime (and add it to the delay loaded dlls). On Windows, you can get the current location from the registry. Query SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion for the current runtime version and SOFTWARE\JavaSoft\Java Runtime Environment\<version>\RuntimeLib for the path of jvm.dll.

    Using those paths you can also check if the required runtime version is present on the system.

    0 讨论(0)
提交回复
热议问题