如何在Qt项目中包含winscard.lib

时间:2018-07-03 06:48:28

标签: c++ qt qt5

我的QT项目遇到问题,包括winscard.lib。 我有Windows 10 x64,并且下载了Microsoft sdk V7.1,因为我在Microsoft sdk v10中没有winscard库。

现在,我的.pro文件如下所示:

QT       += core gui sql

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = NFC
TEMPLATE = app

DEFINES += QT_DEPRECATED_WARNINGS

SOURCES += \
        main.cpp \
        mainwindow.cpp \
    globs.cpp \
    newcard.cpp \
    newcircuitnumber.cpp

HEADERS += \
        mainwindow.h \
    globs.h \
    newcard.h \
    newcircuitnumber.h

FORMS += \
        mainwindow.ui \
    newcard.ui \
    newcircuitnumber.ui


INCLUDEPATH += "C:\Program Files\Microsoft SDKs\Windows\v7.1\Include"
LIBS += -L"C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\IA64"
LIBS += -winscard -lz

mainwindow.h

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDir>
#include <QDebug>
#include <QMessageBox>
#include <QSqlQuery>

#include "globs.h"  
#include "qt_windows.h"
#include "winnt.h" 
#include "winscard.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);   

    SCARDCONTEXT cardContext;
    LPWSTR mszReaders;
    DWORD dwReaders;


    SCardEstablishContext(SCARD_SCOPE_USER,NULL,NULL,&cardContext);
    dwReaders = SCARD_AUTOALLOCATE;
    SCardListReadersW(cardContext,NULL,(LPWSTR)&mszReaders,&dwReaders);

    QByteArray buffer;
    wchar_t *it = mszReaders;

    while(*it !='\0')
    {
        buffer.append(QChar(*it));
        *it++;
    }
   qDebug()<<buffer;
}

尝试编译时出现以下错误:

错误

有人可以指出解决方案吗?我究竟做错了什么? 提前谢谢。

0 个答案:

没有答案