VS2012 Project + openssl(LNK2001)

对不起,英文不好,使用Google.translate试图包含OpenSSL到VS2012项目(DLL)。 1.下载安装程序 (Win32 OpenSSL v1.0.1g,16mb)并安装。 2.build立项目3.并得到一个错误

1>libeay32MDd.lib(cryptlib.obj) : error LNK2001: unresolved external symbol "__imp__GetUserObjectInformationW@20" 1>libeay32MDd.lib(cryptlib.obj) : error LNK2001: unresolved external symbol "__imp__GetProcessWindowStation@0" 1>libeay32MDd.lib(cryptlib.obj) : error LNK2001: unresolved external symbol "__imp__GetDesktopWindow@0" 1>libeay32MDd.lib(cryptlib.obj) : error LNK2001: unresolved external symbol "__imp__MessageBoxA@16" 1>libeay32MDd.lib(cryptlib.obj) : error LNK2001: unresolved external symbol "__imp__DeregisterEventSource@4" 1>libeay32MDd.lib(cryptlib.obj) : error LNK2001: unresolved external symbol "__imp__ReportEventA@36" 1>libeay32MDd.lib(rand_win.obj) : error LNK2001: unresolved external symbol "__imp__DeleteDC@4" 1>libeay32MDd.lib(rand_win.obj) : error LNK2001: unresolved external symbol "__imp__DeleteObject@4" 1>libeay32MDd.lib(rand_win.obj) : error LNK2001: unresolved external symbol "__imp__GetBitmapBits@12" 1>libeay32MDd.lib(rand_win.obj) : error LNK2001: unresolved external symbol "__imp__BitBlt@36" 1>libeay32MDd.lib(rand_win.obj) : error LNK2001: unresolved external symbol "__imp__GetObjectA@12" 1>libeay32MDd.lib(rand_win.obj) : error LNK2001: unresolved external symbol "__imp__SelectObject@8" 1>libeay32MDd.lib(rand_win.obj) : error LNK2001: unresolved external symbol "__imp__CreateCompatibleBitmap@12" 1>libeay32MDd.lib(rand_win.obj) : error LNK2001: unresolved external symbol "__imp__GetDeviceCaps@8" 1>libeay32MDd.lib(rand_win.obj) : error LNK2001: unresolved external symbol "__imp__CreateCompatibleDC@4" 1>libeay32MDd.lib(rand_win.obj) : error LNK2001: unresolved external symbol "__imp__CreateDCA@16" 

链接库

 #pragma comment(lib, "ssleay32xx.lib") #pragma comment(lib, "libeay32xx.lib") 

我尝试了不同版本的库,只是将/ MT更改为/ MD。 图书馆被连接,作为一个函数调用

 CMS_sign(&signcert,&pkey,&certs,&data,NULL); 

不会导致错误。 由function名称来判断是Windows的标准function。

解决问题

 #pragma comment(lib, "User32.lib") #pragma comment(lib, "GDI32.lib") #pragma comment(lib, "Advapi32.lib")