错误LNK2001:未解析的外部符号_SCardEstablishContext @ 16 [英] error LNK2001: unresolved external symbol _SCardEstablishContext@16

查看:415
本文介绍了错误LNK2001:未解析的外部符号_SCardEstablishContext @ 16的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



i有一个奇怪的问题。



错误LNK2001:未解析的外部符号_SCardEstablishContext @ 16

i已将winscard.lib添加到附加依赖库但仍面临此问题。请告诉我



谢谢。

hi all,

i got strange issue.

error LNK2001: unresolved external symbol _SCardEstablishContext@16
i already add winscard.lib to addition dependency library but still facing this issue.please advise me

Thanks.

推荐答案

该错误表示您的项目未与包含函数 SCardEstablishContext 的模块链接。



要检查模块是否已找到并链接,请使用链接器选项 / VERBOSE:LIB 并检查输出。 winscard.lib 文件通常驻留在Windows SDK目录的 lib 文件夹中。此目录应该是全局库搜索路径的一部分。



使用Visual C ++时,您还可以在一个源文件中使用pragma指令指定依赖项: br />
The error indicates that your project is not linked with the module containing the function SCardEstablishContext.

To check if the module is found and linked, use the linker option /VERBOSE:LIB and check the output. The winscard.lib file resides usually in the lib folder of the Windows SDK directory. This directory should be part of the global library search path.

When using Visual C++, you may also specify dependencies using a pragma directive in one of your source files:
#pragma comment(lib, "Winscard")



然后您不必更改项目设置。



使用Visual Studio时,这个简单的源代码应该编译和链接:


Then you don't have to change your project settings.

This simple source should compile and link when using Visual Studio:

#include <winscard.h>
#pragma comment(lib, "Winscard")

void SomeFunc()
{
    SCardEstablishContext(0, 0, 0, 0);
}


检查.lib是否确实在依赖路径中(您可能希望在项目中本地复制它只是为了检查它,在依赖列表中放入真实路径之前)。
Check if the .lib is really in the dependency path (you might want to copy it locally in your project just to check for that, before putting the real path to it in the dependency list).


感谢您的解决方案。问题是winscard.lib我从其他计算机复​​制winsacrd.lib并将其添加到我的解决方案然后没有更多的错误。
thanks for your solution. the problem is winscard.lib i copy winsacrd.lib from other computer and add it to my solution then no more error.


这篇关于错误LNK2001:未解析的外部符号_SCardEstablishContext @ 16的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆