我无法弄清楚为什么我会收到此错误。我猜它是因为我没有实现一个功能。
错误:
Error 2 error LNK2019: unresolved external symbol "private: void __thiscall CGKPRDlg::DisplayError(unsigned long)" (?DisplayError@CGKPRDlg@@AAEXK@Z) referenced in function "public: void __thiscall CGKPRDlg::OnBnClickedDevOpen(void)"
这是我调用函数的地方:
void CGKPRDlg::OnBnClickedDevOpen()
{
if (!m_hBSP)
return;
SecuAPI_DEVICE_ID deviceID;
UpdateData(true);
int index = m_deviceList.GetCurSel();
if (index == 0) // Auto detect
deviceID = SecuAPI_DEVICE_ID_AUTO;
else
deviceID = g_DeviceIDs[index - 1];
SecuAPI_CloseDevice(m_hBSP, m_DeviceID);
m_DeviceID = deviceID;
SecuAPI_RETURN err = SecuAPI_OpenDevice(m_hBSP, m_DeviceID);
if (err)
DisplayError(err); <---------------------------HERE
else
{
m_StatusBar = _T("Function success - [Open Device]");
// Enroll & Verify button enable.
m_enroll.EnableWindow(TRUE);
m_verify.EnableWindow(TRUE);
bool is_autoon_dev = false;
SecuAPI_DEVICE_ID dev_id = SecuAPI_GetOpenedDeviceID(m_hBSP) & 0x00ff;
if (m_DeviceID == SecuAPI_DEVICE_ID_AUTO)
dev_id = SecuAPI_GetOpenedDeviceID(m_hBSP) & 0x00ff;
else
dev_id = m_DeviceID & 0x00ff;
is_autoon_dev = ((dev_id == SecuAPI_DEVICE_NAME_FDU03) || (dev_id == SecuAPI_DEVICE_NAME_FDU04) || (dev_id == SecuAPI_DEVICE_NAME_FDU05)) ?
true : false;
m_chkMonitorDevice.EnableWindow(is_autoon_dev);
m_chkMonitorDevice.SetCheck(BST_UNCHECKED);
}
UpdateData(false);
}
我在cpp文件中包含的头文件中创建它:
private:
void DisplayError(SecuAPI_RETURN errCode);
我知道这很多,但只是试图给予足够的支持。
编辑:这是一个包含的.h文件,我猜这里定义了一堆函数。由于这个原因,我现在猜测它是一个lib链接问题。我猜它的&#39;在他们自己的某个地方定义的,我没有链接。
SecuAPI_RETURN SecuAPI SecuAPI_EnumerateDevice(SecuAPI_HANDLE hHandle, SecuAPI_UINT32* pNumDevice, SecuAPI_DEVICE_ID** ppDeviceID);
SecuAPI_RETURN SecuAPI SecuAPI_OpenDevice (SecuAPI_HANDLE hHandle, SecuAPI_DEVICE_ID nDeviceID);
SecuAPI_RETURN SecuAPI SecuAPI_CloseDevice (SecuAPI_HANDLE hHandle, SecuAPI_DEVICE_ID nDeviceID);
SecuAPI_RETURN SecuAPI SecuAPI_GetDeviceInfo (SecuAPI_HANDLE hHandle, SecuAPI_DEVICE_ID nDeviceID, SecuAPI_UINT8 nStructureType, SecuAPI_DEVICE_INFO_PTR pDeviceInfo);
SecuAPI_RETURN SecuAPI SecuAPI_SetDeviceInfo (SecuAPI_HANDLE hHandle, SecuAPI_DEVICE_ID nDeviceID, SecuAPI_UINT8 nStructureType, SecuAPI_DEVICE_INFO_PTR pDeviceInfo);
SecuAPI_RETURN SecuAPI SecuAPI_AdjustDevice (SecuAPI_HANDLE hHandle, const SecuAPI_WINDOW_OPTION_PTR pWindowOption);
SecuAPI_DEVICE_ID SecuAPI SecuAPI_GetOpenedDeviceID(SecuAPI_HANDLE hHandle);