Gearon Gearon - 1 year ago 122
C++ Question

How to solve my error LNK2019

I have met with LNK2019 error. The details are

error LNK2019: unresolved external symbol imp__JAWT_GetAWT@8
referenced in function "struct HWND
* cdecl
getHwndFromComponent(class jobject *,struct JNIEnv *)"

What I am building is a Win32 Console Application in DLL type.

I have included
. At first, I think it is the problem of 64 bit Java, so I have done things below:

1, Install a 32 bit java

2, Add C:\Program Files (x86)\Java\jdk1.6.0_45\include\win32; to Additional Include Directories.

3, Make sure the java be called in OS level is in C:\Program Files (x86)\Java\jdk1.6.0_45\bin. (Use
java -version
to test it)

However, I still meet the same issue when building the project.

Thanks for your help in advance.

Answer Source

JAWT is a shared library, which means you need to link with it.

Try this:

  1. add C:\Program Files (x86)\Java\jdk1.6.0_45\lib as an additional library path (under linker settings)

  2. add jawt as an additional library (under linker settings)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download