未解析的外部符号SCardEstablishContext

时间:2015-09-20 15:14:50

标签: c++ c visual-studio-2012 smartcard smartcard-reader

我尝试编写一个控制台应用程序来读取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;
}

但是当我尝试在Visual Studio Express 2012中运行/ Local Windows Debugger时出现此错误

  

错误1错误LNK2019:未解析的外部符号   函数_main

中引用了_SCardEstablishContext @ 16

0 个答案:

没有答案