Hello,
I’m trying to test LexActivator on my c++ code on Windows. I use VisualStudio 2019.
I managed to dynamically link it, but I can’t do it statically, neither on the Sample.cpp I’ve downloaded from Cryptlex.
I followed the instructions:

  • I uncommented the block from line 6 to 18
  • In the forum I found that I should include all these additional dependencies:
    $(SolutionDir)x86\LexActivator.lib; $(SolutionDir)x86\libcurl_MD.lib; ws2_32.lib; Winhttp.lib; Shell32.lib
  • I always receive LNK2019 error messages:

    Rebuild started...
    ------ Rebuild All started: Project: Sample, Configuration: Debug Win32 ------
    Sample.cpp
    D:\LicenseExample\Sample.cpp(178,16): warning C4244: 'initializing': conversion from 'time_t' to 'int', possible loss of data
    D:\LicenseExample\Sample.cpp(209,17): warning C4244: 'initializing': conversion from 'time_t' to 'int', possible loss of data
    libcurl_MD.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp__CertOpenStore@20 referenced in function _schannel_connect_step1
    libcurl_MD.lib(schannel_verify.obj) : error LNK2001: unresolved external symbol __imp__CertOpenStore@20
    libcurl_MD.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp__CertCloseStore@8 referenced in function _schannel_connect_step1
    libcurl_MD.lib(schannel_verify.obj) : error LNK2001: unresolved external symbol __imp__CertCloseStore@8
    libcurl_MD.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp__CertEnumCertificatesInStore@8 referenced in function _traverse_cert_store
    libcurl_MD.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp__CertFindCertificateInStore@24 referenced in function _schannel_connect_step1
    libcurl_MD.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp__CertFreeCertificateContext@4 referenced in function _pkp_pin_peer_pubkey
    libcurl_MD.lib(schannel_verify.obj) : error LNK2001: unresolved external symbol __imp__CertFreeCertificateContext@4
    libcurl_MD.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp__CryptStringToBinaryA@28 referenced in function _schannel_connect_step1
    libcurl_MD.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp__PFXImportCertStore@12 referenced in function _schannel_connect_step1
    libcurl_MD.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp__CryptDecodeObjectEx@32 referenced in function _cert_get_name_string
    libcurl_MD.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp__CertAddCertificateContextToStore@16 referenced in function _add_certs_to_store
    libcurl_MD.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp__CertFindExtension@12 referenced in function _cert_get_name_string
    libcurl_MD.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp__CertGetNameStringA@24 referenced in function _cert_get_name_string
    libcurl_MD.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp__CryptQueryObject@44 referenced in function _add_certs_to_store
    libcurl_MD.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp__CertCreateCertificateChainEngine@8 referenced in function _Curl_verify_certificate
    libcurl_MD.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp__CertFreeCertificateChainEngine@4 referenced in function _Curl_verify_certificate
    libcurl_MD.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp__CertGetCertificateChain@32 referenced in function _Curl_verify_certificate
    libcurl_MD.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp__CertFreeCertificateChain@4 referenced in function _Curl_verify_certificate
    D:\LicenseExample\Debug\Sample.exe : fatal error LNK1120: 16 unresolved externals
    Done building project "Sample.vcxproj" -- FAILED.
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
    

    Any hint about how to solve it?

    LexActivator library now uses functions from a Windows library that it didn’t before. The old projects miss this dependency. So you will have to add crypt32.lib in your additional dependencies list as well.

    Regards,
    Ahmad.

    Thank you Ahmad!
    It works now.
    But I switched to my project (x64 configuration) and I get some problems.
    Here are the outputs:

    LexActivator.lib(LexActivator.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexActivator.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexString.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexString.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexDataStore.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexDataStore.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexJsonParser.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexJsonParser.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexAbstraction.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexAbstraction.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexSystemInfo.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexSystemInfo.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexActivationService.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexActivationService.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexThread.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexThread.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexValidator.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexValidator.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexProductData.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexProductData.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexCrypter.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexCrypter.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexCrypto.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexCrypto.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexWmiClient.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexWmiClient.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexHttpClient.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexHttpClient.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexReleaseService.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexReleaseService.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexJwt.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexJwt.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexBotan.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexBotan.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    LexActivator.lib(LexLogger.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in EbClib.obj
    LexActivator.lib(LexLogger.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in EbClib.obj
    

    I found online that this kind of error may be related to runtime library choice.
    I used /MDd option here. I tried all the other options (/MD /MT /MTd) but I only got more errors. Do you have any hint?

    nannx

    Thank you again,
    I got it now and the project compiles!

    Last question (I hope): why do I receive a list of warnings, like:

    LexActivatord.lib(LexActivationService.obj) : warning LNK4099: PDB 'LexActivator.pdb' was not found with 'LexActivatord.lib(LexActivationService.obj)' or at 'D:\EbMnDosy_Outputs\Debug\LexActivator.pdb'; linking object as if no debug info
    LexActivatord.lib(LexCrypto.obj) : warning LNK4099: PDB 'LexActivator.pdb' was not found with 'LexActivatord.lib(LexCrypto.obj)' or at 'D:\EbMnDosy_Outputs\Debug\LexActivator.pdb'; linking object as if no debug info
    LexActivatord.lib(LexDataStore.obj) : warning LNK4099: PDB 'LexActivator.pdb' was not found with 'LexActivatord.lib(LexDataStore.obj)' or at 'D:\EbMnDosy_Outputs\Debug\LexActivator.pdb'; linking object as if no debug info
    

    and so on, both in Debug and Release mode?
    Thank you very much, Ahmad, you have been helpful!

    nannx

    Hi nannx,

    Pleasure is all mine!

    You can safely ignore these warnings. To know how to avoid such warnings please refer to the link below:

    docs.microsoft.com

    I am having a similar issue. I am using Visual Studio 2022. I have downloaded the LexActivator sample, and it compiles when I link to the dynamic library, but not when I link to the static library. I am getting the following error messages:

    Rebuild started...
    1>------ Rebuild All started: Project: Sample, Configuration: Release Win32 ------
    1>Sample.cpp
    1>Generating code
    1>Previous IPDB not found, fall back to full compilation.
    1>All 8 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
    1>Finished generating code
    1>LexActivator.lib(LexActivationService.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexActivationService.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexCrypto.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexCrypto.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexDataStore.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexDataStore.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexLogger.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexLogger.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexReleaseService.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexReleaseService.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexString.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexString.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexSystemInfo.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexSystemInfo.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexThread.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexThread.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexValidator.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexValidator.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexAbstraction.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexAbstraction.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexActivator.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexActivator.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexBotan.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexBotan.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexCrypter.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexCrypter.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexHttpClient.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexHttpClient.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexJsonParser.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexJsonParser.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexJwt.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexJwt.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexProductData.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexProductData.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(LexWmiClient.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(LexWmiClient.obj)' or at ''; linking object as if no debug info
    1>LexActivator.lib(stdafx.obj) : warning LNK4099: PDB '' was not found with 'LexActivator.lib(stdafx.obj)' or at ''; linking object as if no debug info
    1>Sample.vcxproj -> C:\Users\kwalk\source\repos\lexactivator-c-master\examples\Release\Sample.exe
    1>Done building project "Sample.vcxproj".
    ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
    ========== Rebuild started at 5:06 AM and took 01.585 seconds ==========
    

    I have included the following for Additional Library Dependencies:

    C:\Users\kwalk\source\repos\LexActivator-Static-Win-VC14\libs\x86\LexActivator.lib
    C:\Users\kwalk\source\repos\LexActivator-Static-Win-VC14\libs\x86\libcurl_MD.lib
    ws2_32.lib
    Winhttp.lib
    Shell32.lib
    crypt32.lib
    

    Thanks for any help.