Unresolved External Symbol SCardEstablishContext

0

I tried to write a console application to read smart card in C ,

#include <stdio.h>
#include <winscard.h>
#include <SCardErr.h>

#ifndef SCARD_E_NO_READERS_AVAILABLE
#define SCARD_E_NO_READERS_AVAILABLE ((DWORD)0x8010002E)
#endif

SCARD_IO_REQUEST pciT0 = {1, 8};

int main(void)
{
        SCARDCONTEXT hSC;
        SCARDHANDLE hCard;
        char RxBuffer[256];
        char TxBuffer[64];
        char ReaderName[64];
        int retval, dCount, i, dProtocol, dLength, FileNum;
        int split_offset, split_length;
        FILE *outfile, *out2file;

        retval = SCardEstablishContext(SCARD_SCOPE_USER, 0, 0, &hSC);
        if (retval == SCARD_E_NO_SERVICE) {
                printf("Smart card service not started\n");
                goto _Quit;
        }
        else if (retval != 0) {
                printf("SCardEstablishContext Error: %x\n", retval);
                goto _Quit;
        }

_Quit:
        printf("Press enter to exit the program\n");
        getchar();

        return 0;
}

But when I try to run/Local Windows Debugger in Visual Studio Express 2012 I got this error

Error 1 error LNK2019: unresolved external symbol _SCardEstablishContext@16 referenced in function _main

c++
c
visual-studio-2012
smartcard
smartcard-reader
asked on Stack Overflow Sep 20, 2015 by clover1234 • edited Sep 20, 2015 by (unknown user)

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0