LNK2019 and LNK1120

Hello,
I am trying to incorporate the licensing in my C++ app. It throws up the linker errors as below

|Error|LNK2019|unresolved external symbol __imp_SetLicenseKey referenced in function “bool __cdecl enter_key(void)” (?enter_key@@YA_NXZ)|

|Error|LNK2019|unresolved external symbol __imp_SetProductData referenced in function “bool __cdecl check_validate(void)” (?check_validate@@YA_NXZ)|

|Error|LNK2019|unresolved external symbol __imp_SetProductId referenced in function “bool __cdecl check_validate(void)” (?check_validate@@YA_NXZ)

|Error|LNK2019|unresolved external symbol __imp_SetActivationMetadata referenced in function “bool __cdecl enter_key(void)” (?enter_key@@YA_NXZ)

|Error|LNK2019|unresolved external symbol __imp_ActivateLicense referenced in function “bool __cdecl enter_key(void)” (?enter_key@@YA_NXZ)

|Error|LNK2019|unresolved external symbol __imp_IsLicenseGenuine referenced in function “bool __cdecl check_validate(void)” (?check_validate@@YA_NXZ)

|Error|LNK1120|6 unresolved externals

Already carried out changes as per these links.Static linking on windows and Static link on VS2019 but to no avail.

regards

Hi Manish,

We would suggest you to replicate this error using our sample code on Github and then share sample file with us.

Okk… will soon post the result

Hello Ahmad,
With your sample code, the below errors popped up

Severity Code Description Project File Line Suppression State
Warning C6031 Return value ignored: ‘getchar’. \examples\Sample.cpp 110
Warning C6031 Return value ignored: ‘getchar’. \Sample.cpp 138
Warning C6031 Return value ignored: ‘getchar’. \Sample.cpp 215
Warning C4244 ‘initializing’: conversion from ‘time_t’ to ‘int’, possible loss of data \Sample.cpp 167
Warning C4244 ‘initializing’: conversion from ‘time_t’ to ‘int’, possible loss of data \Sample.cpp 198
Error LNK1104 cannot open file ‘x86/LexActivator.lib’ \examples\LINK 1

regards

Hi,

The screenshot won’t be sufficient for us to know what exactly the issue is. Please use our sample code from GitHub to replicate this error and then share that sample code with us.

Hello Ahmad, you can find the sample file here. https://drive.google.com/drive/folders/130WKT5EaaGC2vE4obYeTr8y83wYlr6CD?usp=sharing

regards
Manish

Hi Manish,

The sample code that you have shared does not have Lexactivator.lib linked to it, getting an error
fatal error LNK1104: cannot open file 'x86/LexActivator.lib' is expected. So you need to download the Lexactivator library from the link given below:

After downloading the static Lexactivator library, place Lexactivator.lib and libcurl_MD in the x86 or x64 directory(depending upon the system architecture) of your sample project. Then, uncomment the block of code for windows static build in sample.cpp. Doing this should resolve the issue.

Hello Ahmad,
this is the status after linking the library.

Sample file is here. https://drive.google.com/drive/folders/130WKT5EaaGC2vE4obYeTr8y83wYlr6CD?usp=sharing

regards

Hi Manish,

Yes, you have linked both Lexactivator.lib and libcurl_MD, but as mentioned in Sample.cpp that for windows static build the block of code from line number 6 to line number 18 needs to be uncommented which in your case is still commented.
Attached is the screenshot of how your code should look.

Regards,
Ahmad

Hello Ahmad,
current status

regards

Hi Manish,

It seems that the static library is not yet linked properly, But if you follow the previously mentioned steps properly these errors will get resolved.

If you need further assistance, you can contact us at support@cryptlex.com, where someone from our team will get back to you within few hours.

Regards,
Ahmad

Hello Ahmad,
Apologies for this delay in responding back. Yes, It was a library issue. I downloaded the library again and linked it. The program compiled but faced an issue again. When i use SetLicenseKey(CSTRTYPE(buff));, it throws an error “License activation failed:54” but when I hard code the license key like SetLicenseKey(L"xxxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx"); it works,

regards

Hi Manish,

If you do not want to hard code the license key then you must do it like this.

Windows:
wstring key = L"xxxx-xxxx-xxxx-xxxx";
SetLicenseKey(key.c_str());
Linux:
string key = "xxxx-xxxx-xxxx-xxxx";
SetLicenseKey(key.c_str());

Regards,
Ahmad