0

我在从 msdn 编译本教程时遇到了一些困难:http: //msdn.microsoft.com/en-us/library/windows/desktop/ee207405 (v=vs.85).aspx 。如标题中所述,即使在 VS 2008 中链接使用 dumpbin 和 LIB 命令生成的 winbio.lib 后,我在编译时也得到 No such file or directory,这是代码:

#include <iostream>
#include <Windows.h>
#include <Stdio.h>
#include <Conio.h>
#include <Winbio.h>

HRESULT CaptureSample();

int main(int argc, char** argv) {
HRESULT CaptureSample();
return 0;
}
    HRESULT CaptureSample()
{
HRESULT hr = S_OK;
WINBIO_SESSION_HANDLE sessionHandle = NULL;
WINBIO_UNIT_ID unitId = 0;
WINBIO_REJECT_DETAIL rejectDetail = 0;
PWINBIO_BIR sample = NULL;
SIZE_T sampleSize = 0;

// Connect to the system pool. 
hr = WinBioOpenSession( 
        WINBIO_TYPE_FINGERPRINT,    // Service provider
        WINBIO_POOL_SYSTEM,         // Pool type
        WINBIO_FLAG_RAW,            // Access: Capture raw data
        NULL,                       // Array of biometric unit IDs
        0,                          // Count of biometric unit IDs
        WINBIO_DB_DEFAULT,          // Default database
        &sessionHandle              // [out] Session handle
        );
if (FAILED(hr))
{
    wprintf_s(L"\n WinBioOpenSession failed. hr = 0x%x\n", hr);
    goto e_Exit;
}

// Capture a biometric sample.
wprintf_s(L"\n Calling WinBioCaptureSample - Swipe sensor...\n");
hr = WinBioCaptureSample(
        sessionHandle,
        WINBIO_NO_PURPOSE_AVAILABLE,
        WINBIO_DATA_FLAG_RAW,
        &unitId,
        &sample,
        &sampleSize,
        &rejectDetail
        );
if (FAILED(hr))
{
    if (hr == WINBIO_E_BAD_CAPTURE)
    {
        wprintf_s(L"\n Bad capture; reason: %d\n", rejectDetail);
    }
    else
    {
        wprintf_s(L"\n WinBioCaptureSample failed. hr = 0x%x\n", hr);
    }
    goto e_Exit;
}

wprintf_s(L"\n Swipe processed - Unit ID: %d\n", unitId);
wprintf_s(L"\n Captured %d bytes.\n", sampleSize);
e_Exit:
if (sample != NULL)
{
    WinBioFree(sample);
    sample = NULL;
}

if (sessionHandle != NULL)
{
    WinBioCloseSession(sessionHandle);
    sessionHandle = NULL;
}

wprintf_s(L"\n Press any key to exit...");
_getch();

return hr;
}
4

2 回答 2

2

尝试下载 Windows 工具包(8.0 或 8.1)——至少那是我拥有 Winbio.h 的地方。它与 Visual Studio 2012 一起安装,但可以单独下载。

于 2013-07-21T16:47:16.107 回答
2

在 VS 2008 中使用 dumpbin 和 LIB 命令

您肯定使用的是旧版本的 Windows SDK。VS2008 附带版本 6.0。但是,此 API 仅适用于 2009 年发布的 Windows 7。您需要更新您的 SDK,我推荐版本 7.1

于 2013-07-21T16:47:33.357 回答