Link errors for Crypto++ 5.4 on Win32

2138 views
Skip to first unread message

argo...@gmail.com

unread,
Sep 28, 2007, 4:15:38 PM9/28/07
to Crypto++ Users
I'm receiving the following errors in my project when I try to link
against cryptopp (I'm building the dynamic version of Crypto++, which
produces cryptopp.dll, cryptopp.exp and cryptopp.lib --> this is
the .lib I'm linking against):

-----------------------------------------------------------------------------------------------------------------------------------------------------
Crypto.obj : error LNK2019: unresolved external symbol "public:
virtual void __t

hiscall CryptoPP::Base64Encoder::IsolatedInitialize(class
CryptoPP::NameValuePai

rs const &)" (?
IsolatedInitialize@Base64Encoder@CryptoPP@@UAEXABVNameValuePairs@

2@@Z) referenced in function "public: __thiscall
CryptoPP::Base64Encoder::Base64

Encoder(class CryptoPP::BufferedTransformation *,bool,int)" (??
0Base64Encoder@Cr

yptoPP@@QAE@PAVBufferedTransformation@1@_NH@Z)

Crypto.obj : error LNK2019: unresolved external symbol "private:
static int cons

t * __cdecl CryptoPP::Base64Decoder::GetDecodingLookupArray(void)" (?
GetDecoding

LookupArray@Base64Decoder@CryptoPP@@CAPBHXZ) referenced in function
"public: __t

hiscall CryptoPP::Base64Decoder::Base64Decoder(class
CryptoPP::BufferedTransform

ation *)" (??
0Base64Decoder@CryptoPP@@QAE@PAVBufferedTransformation@1@@Z)

Crypto.obj : error LNK2019: unresolved external symbol "public:
virtual void __t

hiscall CryptoPP::Base32Encoder::IsolatedInitialize(class
CryptoPP::NameValuePai

rs const &)" (?
IsolatedInitialize@Base32Encoder@CryptoPP@@UAEXABVNameValuePairs@

2@@Z) referenced in function "public: __thiscall
CryptoPP::Base32Encoder::Base32

Encoder(class CryptoPP::BufferedTransformation *,bool,int,class
std::basic_strin

g<char,struct std::char_traits<char>,class std::allocator<char> >
const &,class

std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char>

> const &)" (??0Base32Encoder@CryptoPP@@QAE@PAVBufferedTransformation@1@_NHABV?$

basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@2@Z)

Crypto.obj : error LNK2019: unresolved external symbol "private:
static int cons

t * __cdecl
CryptoPP::Base32Decoder::GetDefaultDecodingLookupArray(void)" (?GetD

efaultDecodingLookupArray@Base32Decoder@CryptoPP@@CAPBHXZ) referenced
in functio

n "public: __thiscall CryptoPP::Base32Decoder::Base32Decoder(class
CryptoPP::Buf

feredTransformation *)" (??
0Base32Decoder@CryptoPP@@QAE@PAVBufferedTransformatio

n@1@@Z)

Crypto.obj : error LNK2001: unresolved external symbol "public:
virtual void __t

hiscall CryptoPP::Base32Decoder::IsolatedInitialize(class
CryptoPP::NameValuePai

rs const &)" (?
IsolatedInitialize@Base32Decoder@CryptoPP@@UAEXABVNameValuePairs@

2@@Z)

Crypto.obj : error LNK2001: unresolved external symbol "public: static
class std

::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > c

onst CryptoPP::BufferedTransformation::NULL_CHANNEL" (?
NULL_CHANNEL@BufferedTran

sformation@CryptoPP@@2V?$basic_string@DU?$char_traits@D@std@@V?
$allocator@D@2@@s

td@@B)

Crypto.obj : error LNK2001: unresolved external symbol "class
CryptoPP::NullName

ValuePairs const CryptoPP::g_nullNameValuePairs" (?
g_nullNameValuePairs@CryptoPP

@@3VNullNameValuePairs@1@B)

Crypto.obj : error LNK2001: unresolved external symbol "bool (__cdecl*
CryptoPP:

:g_pAssignIntToInteger)(class type_info const &,void *,void const
*)" (?g_pAssig

nIntToInteger@CryptoPP@@3P6A_NABVtype_info@@PAXPBX@ZA)

build\win32-dynamic-debug\base\src\base.dll : fatal error LNK1120: 8
unresolved

externals
-----------------------------------------------------------------------------------------------------------------------------------------------------

I'm using sCons to build my own version of Crypto++ using the MSVC
2005 toolchain and the following DEFINES:

"WIN32",

"_WINDOWS",

"_USRDLL",

"_MBCS",

"CRYPTOPP_EXPORTS",

"CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2=1",

"USE_PRECOMPILED_HEADERS",


Any ideas?

Thanks in advance,

Nick

Jeffrey Walton

unread,
Sep 28, 2007, 5:00:22 PM9/28/07
to argo...@gmail.com, Crypto++ Users
Hi Nick,

In which directory is the LIB file residing? This is usually the
result of desiring to use the DLL, but linking against the static LIB
file (or vice versa).

I only have a static lib available on this machine for 5.5.1:
Static: ...\Win32\cryptlib\Debug and ...\Win32\cryptlib\Release
DLL: ?

Jeff

argo...@gmail.com

unread,
Sep 28, 2007, 5:08:26 PM9/28/07
to Crypto++ Users
Hey Jeff,

I'm copying the import lib generated from the DLL to my project's lib
directory, which is a parameter of my LIBPATH. Maybe I need to also
generate the static lib and link against that one, instead of the
import lib?

On Sep 28, 4:00 pm, "Jeffrey Walton" <noloa...@gmail.com> wrote:
> Hi Nick,
>
> In which directory is the LIB file residing? This is usually the
> result of desiring to use the DLL, but linking against the static LIB
> file (or vice versa).
>
> I only have a static lib available on this machine for 5.5.1:
> Static: ...\Win32\cryptlib\Debug and ...\Win32\cryptlib\Release
> DLL: ?
>
> Jeff
>

Jeffrey Walton

unread,
Sep 28, 2007, 5:17:58 PM9/28/07
to argo...@gmail.com, Crypto++ Users
Hi Nick,

> Maybe I need to also generate the static lib and link
> against that one, instead of the import lib?

In the past, Wei has recommended using the static over the dynamic
unless you need FIPS compliance.

I personally use the static version of the library. If you don't have
a taste, and want to use the static version, here are some directions:
http://www.codeproject.com/tips/CryptoPPIntegration.asp

Otherwise, if you want to use the DLL, get the DLL and it's lib on
PATH as described in the link above.

Jeff

On 9/28/07, argo...@gmail.com <argo...@gmail.com> wrote:
>

argo...@gmail.com

unread,
Sep 28, 2007, 5:32:56 PM9/28/07
to Crypto++ Users
Jeff,

Thanks for the response. I'm building my project dynamically and
trying to build all external dependencies dynamically as well.
However, if I must build a static Crypto++ library to link against, I
can do that. I was just wondering if I was missing some DEFINE or
some compiler option that would insert the missing symbols into the
import library that's being generated when I build the DLL.

-Nick

On Sep 28, 4:17 pm, "Jeffrey Walton" <noloa...@gmail.com> wrote:
> Hi Nick,
>

> > Maybe I need to also generate the static lib and link
> > against that one, instead of the import lib?
>
> In the past, Wei has recommended using the static over the dynamic
> unless you need FIPS compliance.
>
> I personally use the static version of the library. If you don't have
> a taste, and want to use the static version, here are some directions:http://www.codeproject.com/tips/CryptoPPIntegration.asp
>
> Otherwise, if you want to use the DLL, get the DLL and it's lib on
> PATH as described in the link above.
>
> Jeff
>

Jeffrey Walton

unread,
Sep 28, 2007, 5:49:21 PM9/28/07
to argo...@gmail.com, Crypto++ Users
Hi Nick,


> I'm building my project dynamically and
> trying to build all external dependencies dynamically as well.

If your'e project is dynamic, make all things dynamic. This include
Crypto++. Otherwise' you'll have nothing but trouble with multiply
imported symbols.

As far as Crypto++ goes, you can still build a static version of the
library - however it must use a dynamic link setting. For this, change
the Project settings in Crypo++, and rebuild your static and dynamic
library versions. This is set under Configuration Properties, C++,
Code Generation.

Jeff

On 9/28/07, argo...@gmail.com <argo...@gmail.com> wrote:
>

Jeffrey Walton

unread,
Sep 28, 2007, 5:59:09 PM9/28/07
to argo...@gmail.com, Crypto++ Users
Hi Nick,

To clarify this, if you are using MFC and dynamically linking, set
Code Generation to Multi-threaded Debug DLL (/MDd) and Multi-threaded
DLL (/MD).

If you are using MFC and statically linking, set Code generation
Multi-threaded Debug (/MTd) and Multi-threaded (/MT).

Once Crypto++ is properly built, get it on PATH for your current
project. You can still use the static or DLL version of Crypto++, but
Crypto++ has to use the same runtime settings as the parent project.

Jeff

On 9/28/07, Jeffrey Walton <jeffrey....@gmail.com> wrote:
> Hi Nick,


>
> > I'm building my project dynamically and
> > trying to build all external dependencies dynamically as well.

> If your'e project is dynamic, make all things dynamic. This include
> Crypto++. Otherwise' you'll have nothing but trouble with multiply
> imported symbols.
>
> As far as Crypto++ goes, you can still build a static version of the
> library - however it must use a dynamic link setting. For this, change
> the Project settings in Crypo++, and rebuild your static and dynamic
> library versions. This is set under Configuration Properties, C++,
> Code Generation.
>

> Jeff
>
> On 9/28/07, argo...@gmail.com <argo...@gmail.com> wrote:
> >

Wei Dai

unread,
Sep 30, 2007, 6:31:42 PM9/30/07
to argo...@gmail.com, Crypto++ Users
Non-FIPS-related algorithms such Base 64 encoder/decoder, are not exported
from the DLL. There are two ways you can deal with this, either change
Crypto++ to export those classes, by using CRYPTOPP_DLL macro, or link with
both the DLL export library and a static library that contains the non-DLL
classes and functions. The latter can be build by using the "DLL-Import"
configuration of the cryptlib project.

See also "MSVC-Specific Information" section in Readme.txt.

--------------------------------------------------
From: <argo...@gmail.com>
Sent: Friday, September 28, 2007 1:15 PM
To: "Crypto++ Users" <cryptop...@googlegroups.com>
Subject: Link errors for Crypto++ 5.4 on Win32

argo...@gmail.com

unread,
Oct 1, 2007, 5:08:51 PM10/1/07
to Crypto++ Users
Thanks for the tip. I ended up using your second suggestion, i.e.
generating the DLL + export lib as well as the static library built
with the "CRYPTOPP_IMPORTS" macro, and linking my code against both.

On Sep 30, 5:31 pm, "Wei Dai" <wei...@weidai.com> wrote:
> Non-FIPS-related algorithms such Base 64 encoder/decoder, are not exported
> from the DLL. There are two ways you can deal with this, either change
> Crypto++ to export those classes, by using CRYPTOPP_DLL macro, or link with
> both the DLL export library and a static library that contains the non-DLL
> classes and functions. The latter can be build by using the "DLL-Import"
> configuration of the cryptlib project.
>
> See also "MSVC-Specific Information" section in Readme.txt.
>
> --------------------------------------------------

> From: <argone...@gmail.com>

Reply all
Reply to author
Forward
0 new messages