VS2012项目+ openssl(LNK2001)

时间:2014-04-29 20:29:57

标签: c windows winapi linker openssl

抱歉英文不好,请使用Google.translate 试图将OpenSSL包含在VS2012的项目(DLL)中。  1.下载installer(Win32 OpenSSL v1.0.1g,16mb)并安装。  2.建立项目  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);

不会导致错误。判断函数的名称是标准函数Windows。

1 个答案:

答案 0 :(得分:5)

解决问题

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