안녕하세요

프로그램 과정에서 막혔던 문제들에 대한 해결책 정리


페이지 목록

2013년 1월 25일 금요일

Unresolved Externals 해결 방법

참조 : http://www.chilkatsoft.com/p/p_124.asp

Win32 Visual C++ 링커 문제를 해결하는 방법을 알려드립니다.

아래와 같이 문제가 있을 때,

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)

여기에는 몇개의 unresolved 한 함수가 있습니다.
CryptAcquireContextA
CryptGetHashParam
CryptDestroyHash

등인데요. ( "___imp___" 와 "@" 뒤에 나오는 쓰레기 값들은 그냥 C++에서 이름을 알아 보기 힘들게 만들어 놓은 거니깐 무시하세요)
A로 끝나는 함수는 ANSI version의 함수고, W로 끝나는 것은 Unicode 버전 입니다.

A 와 W 를 없애면
CryptAcquireContext
CryptGetHashParam
CryptDestroyHash

함수가 나타나는데, 이제 검색엔진을 이용해서 위 함수를 검색하세요.
search engine (Yahoo, Microsoft, Google, etc.) "site:microsoft.com"
등에서 MSDN result 페이지가 나오면, 맨 밑의 Requirements 세션으로 가서,
무슨 Library가 필요한지 찾아서, VC++ Project에 add 하면 됩니다.