Click here to Skip to main content
15,877,915 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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


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")

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);
Share this answer
CPallini 29-Apr-14 3:38am    
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).
Share this answer
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.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900