本文介绍了对'功能'的未定义引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我附上了一个代码。对'SCardEstablishContext @ 16'和'SCardConnectA @ 24'的未定义引用不断出现。该怎么办?
SCARDCONTEXT hSC;
LONG lReturn;
// 建立上下文。
lReturn = SCardEstablishContext(SCARD_SCOPE_USER,
NULL,
NULL,
& hSC);
if (SCARD_S_SUCCESS!= lReturn)
printf( 失败的SCardEstablishContext \ n);
else
{
SCARDHANDLE hCardHandle;
LONG lReturn1;
DWORD dwAP;
lReturn1 = SCardConnect(hSC,
(LPCTSTR) Rainbow Technologies SCR3531 0 ,
SCARD_SHARE_SHARED,
SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1,
& hCardHandle,
& dwAP);
if (SCARD_S_SUCCESS!= lReturn1)
{
printf( SCardConnect\ n失败);
退出( 1 ); // 或其他适当的操作。
}
// 使用连接。
// 显示活动协议。
switch (dwAP)
{
case SCARD_PROTOCOL_T0:
printf( 有效协议T0 \ n);
break ;
case SCARD_PROTOCOL_T1:
printf( 活动协议T1 \ n);
break ;
case SCARD_PROTOCOL_UNDEFINED:
默认:
printf ( 未协商或未知的活动协议);
break ;
}
}
解决方案
i have this attached with a code. undefined reference to 'SCardEstablishContext@16' and 'SCardConnectA@24' keeps coming. what to do?
SCARDCONTEXT hSC; LONG lReturn; // Establish the context. lReturn = SCardEstablishContext(SCARD_SCOPE_USER, NULL, NULL, &hSC); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardEstablishContext\n"); else { SCARDHANDLE hCardHandle; LONG lReturn1; DWORD dwAP; lReturn1 = SCardConnect( hSC, (LPCTSTR)"Rainbow Technologies SCR3531 0", SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, &hCardHandle, &dwAP ); if ( SCARD_S_SUCCESS != lReturn1 ) { printf("Failed SCardConnect\n"); exit(1); // Or other appropriate action. } // Use the connection. // Display the active protocol. switch ( dwAP ) { case SCARD_PROTOCOL_T0: printf("Active protocol T0\n"); break; case SCARD_PROTOCOL_T1: printf("Active protocol T1\n"); break; case SCARD_PROTOCOL_UNDEFINED: default: printf("Active protocol unnegotiated or unknown\n"); break; } }
解决方案
这篇关于对'功能'的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!