Crypto 64 bit library produced unresolved external symbols linking errors(LNK2019) for Windows application

887 views
Skip to first unread message

Lakshmi Chowdam

unread,
Oct 31, 2016, 6:52:38 AM10/31/16
to Crypto++ Users
Hi Team,

I have built 64 bit crypto library for windows application(64 bit) with the option "Multi-threaded Debug DLL (/MDd)"

When I compiled the code, I am getting many unresolved external symbols linking errors(LNK2019) as below:

LNK2019 unresolved external symbol "void __cdecl CryptoPP::xorbuf(unsigned char *,unsigned char const *,unsigned char const *,unsigned __int64)" (?xorbuf@CryptoPP@@YAXPEAEPEBE1_K@Z) referenced in function "public: virtual struct CryptoPP::DecodingResult __cdecl CryptoPP::DL_EncryptionAlgorithm_Xor<class CryptoPP::HMAC<class CryptoPP::SHA1>,0>::SymmetricDecrypt(unsigned char const *,unsigned char const *,unsigned __int64,unsigned char *,class CryptoPP::NameValuePairs const &)const " (?SymmetricDecrypt@?$DL_EncryptionAlgorithm_Xor@V?$HMAC@VSHA1@CryptoPP@@@CryptoPP@@$0A@@CryptoPP@@UEBA?AUDecodingResult@2@PEBE0_KPEAEAEBVNameValuePairs@2@@Z)

LNK2019 unresolved external symbol "void __cdecl CryptoPP::UnalignedDeallocate(void *)" (?UnalignedDeallocate@CryptoPP@@YAXPEAX@Z) referenced in function "public: void __cdecl CryptoPP::AllocatorWithCleanup<unsigned char,0>::deallocate(void *,unsigned __int64)" (?deallocate@?$AllocatorWithCleanup@E$0A@@CryptoPP@@QEAAXPEAX_K@Z)

LNK2019 unresolved external symbol "void __cdecl CryptoPP::P1363_MGF1KDF2_Common(class CryptoPP::HashTransformation &,unsigned char *,unsigned __int64,unsigned char const *,unsigned __int64,unsigned char const *,unsigned __int64,bool,unsigned int)" (?P1363_MGF1KDF2_Common@CryptoPP@@YAXAEAVHashTransformation@1@PEAE_KPEBE232_NI@Z) referenced in function "public: static void __cdecl CryptoPP::P1363_KDF2<class CryptoPP::SHA1>::DeriveKey(unsigned char *,unsigned __int64,unsigned char const *,unsigned __int64,unsigned char const *,unsigned __int64)" (?DeriveKey@?$P1363_KDF2@VSHA1@CryptoPP@@@CryptoPP@@SAXPEAE_KPEBE121@Z)


The application is build successful for 32 bit, but producing the above linking errors for 64 bit builds. Please let me know how I resolve these issues.


Thanks,
Lakshmi Chowdam.

Jeffrey Walton

unread,
Oct 31, 2016, 7:13:15 AM10/31/16
to Crypto++ Users

I have built 64 bit crypto library for windows application(64 bit) with the option "Multi-threaded Debug DLL (/MDd)"

How did you build it?
 
When I compiled the code, I am getting many unresolved external symbols linking errors(LNK2019) as below:

How did you set up your projects, and how are you linking to the library?

Jeff

Lakshmi Chowdam

unread,
Oct 31, 2016, 7:36:34 AM10/31/16
to Crypto++ Users


On Monday, October 31, 2016 at 4:43:15 PM UTC+5:30, Jeffrey Walton wrote:

I have built 64 bit crypto library for windows application(64 bit) with the option "Multi-threaded Debug DLL (/MDd)"

How did you build it?


Changed the properties as:

1) Platform Toolset-> Visual Studio 2013 (v120)
2) C/C++->Code Generation -> Runtime Library as Multi-threaded Debug DLL (/MDd) (This configuration I used because of Json code expected /MDd)
3) checked the corresponding build from the Build->Batch Build 

I am using MVSC 2015, SP3.  
 
When I compiled the code, I am getting many unresolved external symbols linking errors(LNK2019) as below:

How did you set up your projects, and how are you linking to the library?

My project is with the Visual Studio 2013 (v120) and Runtime Library is not selected any thing. This is a MFC Shared DLL and its using Unicode Character Set

I have placed the library in the Dependencies folder and linked with the below property in the project properties:
            <IncludePath>..\..\Dependencies\cryptopp\include;$(IncludePath)</IncludePath>
             <LibraryPath>..\..\Dependencies\cryptopp\lib\$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>

and also, in the link property <AdditionalDependencies>cryptopp_$(PlatformToolset).lib;%(AdditionalDependencies)</AdditionalDependencies>
 
Please let me know if you need more information on this?


Jeff

Jeffrey Walton

unread,
Oct 31, 2016, 8:16:45 AM10/31/16
to Crypto++ Users

and also, in the link property <AdditionalDependencies>cryptopp_$(PlatformToolset).lib;%(AdditionalDependencies)</AdditionalDependencies>

This does not look right to me. The static library is called cryptlib.lib. I don't ever recall seeing it named like cryptlib_v120.lib.

Can you verify the filename?

Jeff

Jeffrey Walton

unread,
Oct 31, 2016, 8:34:49 AM10/31/16
to Lakshmi Chowdam, Crypto++ Users
> Changed the properties as:
>
> 1) Platform Toolset-> Visual Studio 2013 (v120)
> 2) C/C++->Code Generation -> Runtime Library as Multi-threaded Debug DLL
> (/MDd) (This configuration I used because of Json code expected /MDd)
> 3) checked the corresponding build from the Build->Batch Build
>
> I am using MVSC 2015, SP3.
>>
>>
>>>
>>> When I compiled the code, I am getting many unresolved external symbols
>>> linking errors(LNK2019) as below:
>>>
>> How did you set up your projects, and how are you linking to the library?
>
>
> My project is with the Visual Studio 2013 (v120) and Runtime Library is not
> selected any thing. This is a MFC Shared DLL and its using Unicode Character
> Set

You can also get a pre-converted set of project files from
https://cryptopp.com/wiki/File:Vs2010-dynamic.zip.

While you are on the wiki, you might want to visit
https://cryptopp.com/wiki/Visual_Studio and
https://cryptopp.com/wiki/FIPS_DLL.

The DLL is awful. If you are using it, then I would encourage you to
switch to the static library.

Jeff

Lakshmi Chowdam

unread,
Nov 1, 2016, 12:01:49 AM11/1/16
to Crypto++ Users


On Monday, October 31, 2016 at 5:46:45 PM UTC+5:30, Jeffrey Walton wrote:

and also, in the link property <AdditionalDependencies>cryptopp_$(PlatformToolset).lib;%(AdditionalDependencies)</AdditionalDependencies>

This does not look right to me. The static library is called cryptlib.lib. I don't ever recall seeing it named like cryptlib_v120.lib.

Yes, the static library created as cryptlib.lib, bur for my requirement it is renamed  based on the PlatformToolset.

Lakshmi Chowdam

unread,
Nov 1, 2016, 12:17:16 AM11/1/16
to Crypto++ Users, chowdam...@gmail.com, nolo...@gmail.com
Thanks Jeff, I will look into it.
 
Jeff

Lakshmi Chowdam

unread,
Nov 1, 2016, 6:46:21 AM11/1/16
to Crypto++ Users, chowdam...@gmail.com, nolo...@gmail.com
Hi Jeff, 

I have used the provided pre-converted set of project files except <PlatformToolset>v120</PlatformToolset>

I have created the library successfully and when I integrated in my application it produced couple of link errors as below:

LNK2001 unresolved external symbol "public: virtual void __cdecl CryptoPP::DL_SignatureMessageEncodingMethod_DSA::ComputeMessageRepresentative(class CryptoPP::RandomNumberGenerator &,unsigned char const *,unsigned __int64,class CryptoPP::HashTransformation &,struct std::pair<unsigned char const *,unsigned __int64>,bool,unsigned char *,unsigned __int64)const " (?ComputeMessageRepresentative@DL_SignatureMessageEncodingMethod_DSA@CryptoPP@@UEBAXAEAVRandomNumberGenerator@2@PEBE_KAEAVHashTransformation@2@U?$pair@PEBE_K@std@@_NPEAE2@Z)

LNK2001 unresolved external symbol "public: virtual bool __cdecl CryptoPP::PK_DeterministicSignatureMessageEncodingMethod::VerifyMessageRepresentative(class CryptoPP::HashTransformation &,struct std::pair<unsigned char const *,unsigned __int64>,bool,unsigned char *,unsigned __int64)const " (?VerifyMessageRepresentative@PK_DeterministicSignatureMessageEncodingMethod@CryptoPP@@UEBA_NAEAVHashTransformation@2@U?$pair@PEBE_K@std@@_NPEAE_K@Z)

Are these problems with the PlatformToolset is set to v120? 

Thanks,
Lakshmi.

Jeffrey Walton

unread,
Nov 1, 2016, 7:27:44 AM11/1/16
to Lakshmi Chowdam, Crypto++ Users
> Hi Jeff,
>
> I have used the provided pre-converted set of project files except
> <PlatformToolset>v120</PlatformToolset>
>
> I have created the library successfully and when I integrated in my
> application it produced couple of link errors as below:
>
> LNK2001 unresolved external symbol "public: virtual void __cdecl
> CryptoPP::DL_SignatureMessageEncodingMethod_DSA::ComputeMessageRepresentative(class
> CryptoPP::RandomNumberGenerator &,unsigned char const *,unsigned
> __int64,class CryptoPP::HashTransformation &,struct std::pair<unsigned char
> const *,unsigned __int64>,bool,unsigned char *,unsigned __int64)const "
> (?ComputeMessageRepresentative@DL_SignatureMessageEncodingMethod_DSA@CryptoPP@@UEBAXAEAVRandomNumberGenerator@2@PEBE_KAEAVHashTransformation@2@U?$pair@PEBE_K@std@@_NPEAE2@Z)
>
> LNK2001 unresolved external symbol "public: virtual bool __cdecl
> CryptoPP::PK_DeterministicSignatureMessageEncodingMethod::VerifyMessageRepresentative(class
> CryptoPP::HashTransformation &,struct std::pair<unsigned char const
> *,unsigned __int64>,bool,unsigned char *,unsigned __int64)const "
> (?VerifyMessageRepresentative@PK_DeterministicSignatureMessageEncodingMethod@CryptoPP@@UEBA_NAEAVHashTransformation@2@U?$pair@PEBE_K@std@@_NPEAE_K@Z)
>
> Are these problems with the PlatformToolset is set to v120?

I can't duplicate the issue using the latest sources. That's under
bother Vs2010.zip and Vs2010-dynamic.zip. For completeness, I
performed a Build -> Batch Build -> Build All. The Build All builds
all of the 24 configurations as described on the Visual Studio wiki
page (https://www.cryptopp.com/wiki/Visual_Studio#Projects_and_Configurations).

I guess the next question to ask is, what version of the library are
you using, and where did you get the library? As far as I know, a
similar issue under Clang was cleared via
https://github.com/weidai11/cryptopp/issues/300. Clang's fix broke
Visual Studio momentarily, but it was cleared the same day.

Issue 300 was cleared on September 22. The two surrounding releases
were Crypto++ 5.6.4 on September 11, and Crypto++ 5.6.5 on October 11.
There should be no release ZIPs in the wild that are half fixed.

Jeff

Jeffrey Walton

unread,
Nov 1, 2016, 8:56:20 AM11/1/16
to Crypto++ Users, chowdam...@gmail.com, nolo...@gmail.com

> LNK2001 unresolved external symbol "public: virtual void __cdecl
> CryptoPP::DL_SignatureMessageEncodingMethod_DSA::ComputeMessageRepresentative(class
> CryptoPP::RandomNumberGenerator &,unsigned char const *,unsigned
> __int64,class CryptoPP::HashTransformation &,struct std::pair<unsigned char
> const *,unsigned __int64>,bool,unsigned char *,unsigned __int64)const "
> (?ComputeMessageRepresentative@DL_SignatureMessageEncodingMethod_DSA@CryptoPP@@UEBAXAEAVRandomNumberGenerator@2@PEBE_KAEAVHashTransformation@2@U?$pair@PEBE_K@std@@_NPEAE2@Z)
>
> LNK2001 unresolved external symbol "public: virtual bool __cdecl
> CryptoPP::PK_DeterministicSignatureMessageEncodingMethod::VerifyMessageRepresentative(class
> CryptoPP::HashTransformation &,struct std::pair<unsigned char const
> *,unsigned __int64>,bool,unsigned char *,unsigned __int64)const "
> (?VerifyMessageRepresentative@PK_DeterministicSignatureMessageEncodingMethod@CryptoPP@@UEBA_NAEAVHashTransformation@2@U?$pair@PEBE_K@std@@_NPEAE_K@Z)
>
> Are these problems with the PlatformToolset is set to v120?

I can't duplicate the issue using the latest sources. That's under
bother Vs2010.zip and Vs2010-dynamic.zip. For completeness, I
performed a Build -> Batch Build -> Build All. The Build All builds
all of the 24 configurations as described on the Visual Studio wiki
page (https://www.cryptopp.com/wiki/Visual_Studio#Projects_and_Configurations).

I guess the next question to ask is, what version of the library are
you using, and where did you get the library? As far as I know, a
similar issue under Clang was cleared via
https://github.com/weidai11/cryptopp/issues/300. Clang's fix broke
Visual Studio momentarily, but it was cleared the same day.

I just went back to the Crypto++ 5.6.5 ZIP and repeated the exercise with the static and dynamic projects. Everything worked as expected.

I'm guessing there's something wonky going on with your project configuration. Did you include the same preprocessor macro definitions in your project that Crypto++ uses? You can see what Crypto++ uses for them by inspecting a project file's; see for example https://github.com/weidai11/cryptopp/blob/master/cryptlib.vcxproj. You can see what a macro does at https://cryptopp.com/wiki/Config.h.

Jeff

Lakshmi Chowdam

unread,
Nov 3, 2016, 7:27:07 AM11/3/16
to Crypto++ Users, chowdam...@gmail.com, nolo...@gmail.com
Thanks Jeff,

It is the problem of the Module-Definition file of one of project module. Now we are able to build the application successful.

Thanks for your support.

Thanks,
Lakshmi. 
Reply all
Reply to author
Forward
0 new messages