Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component


Index of Chilkat Blog Posts

October 30, 2006

C++ 101: Solving Unresolved Externals in Microsoft Visual C++

How does one go about determining how to resolve unresolved externals when linking Win32 Visual C++ programs? Here’s what I do…

First, you’ll get a link error report such as this:

ChilkatDbgDll.lib(CryptoSP.obj) : error LNK2001: unresolved external symbol __imp__CryptAcquireContextA@20
ChilkatDbgDll.lib(Hashing.obj) : error LNK2019: unresolved external symbol __imp__CryptGetHashParam@20 referenced in function "public: bool __thiscall Hashing::hashSha1(class DataBuffer const &,class DataBuffer &,class LogBase &)" (?hashSha1@Hashing@@QAE_NABVDataBuffer@@AAV2@AAVLogBase@@@Z)
ChilkatDbgDll.lib(Hashing.obj) : error LNK2019: unresolved external symbol __imp__CryptDestroyHash@4 referenced in function "public: bool __thiscall Hashing::hashSha1(class DataBuffer const &,class DataBuffer &,class LogBase &)" (?hashSha1@Hashing@@QAE_NABVDataBuffer@@AAV2@AAVLogBase@@@Z)

There are a few unresolveds in this short list:
CryptAcquireContextA
CryptGetHashParam
CryptDestroyHash

(ignore the "__imp__" and the garbage after "@", which is just C++ name mangling).
Functions ending with an "A" are ANSI versions of the function, whereas functions ending in "W" are Unicode versions. Drop the "A" or "W", so we have this:

CryptAcquireContext
CryptGetHashParam
CryptDestroyHash

Go to a search engine (Yahoo, Microsoft, Google, etc.) and search for the function. You might also add "site:microsoft.com" to your search terms to restrict the search to Microsoft’s site.

You’re looking for the MSDN result page for the Windows SDK. For example, the page for CryptAcquireContext is:
http://windowssdk.msdn.microsoft.com/en-us/library/ms723945.aspx

Scroll to the bottom of the page where you’ll find a "Requirements" section. This table will tell you the library that is required. If it is not a standard library included when you create the VC++ project, you’ll need to add it to your list of link libs.


Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.