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