2

Linux で Qt を使用して、Mifare 1K カードを読み取ることができるプログラムを正常に作成しました。だから今、私はそれをWindowsで実行したいと思っています。私が収集したものから、Windows には PCSC-Lite ポートがなく、Windows SDK の winscard を使用する必要があります。私はそれをダウンロードしましたが、Windows の Qt (MingW を使用) から多くの未定義の参照エラーが発生しました。例えば:

release/ReadCard.o:ReadCard.cpp:(.text+0x48e): `pcsc_stringify_error' への未定義の参照
release/ReadCard.o:ReadCard.cpp:(.text+0x5e9): `pcsc_stringify_error' への未定義の参照
release/ReadCard.o:ReadCard.cpp:(.text+0x7ed): `pcsc_stringify_error' への未定義の参照
release/ReadCard.o:ReadCard.cpp:(.text+0x2e56): 「SCardListReaderGroups」への未定義の参照
release/ReadCard.o:ReadCard.cpp:(.text+0x3adc): 「SCardListReaders」への未定義の参照
release/ReadCard.o:ReadCard.cpp:(.text+0x3cc6): 「SCardListReaders」への未定義の参照
release/ReadCard.o:ReadCard.cpp:(.text+0x3f88): `SCardGetStatusChange' への未定義の参照
release/ReadCard.o:ReadCard.cpp:(.text+0x4274): 「SCardConnect」への未定義の参照
release/ReadCard.o:ReadCard.cpp:(.text+0x4d1b): `SCardGetStatusChange への未定義の参照

プロジェクトでこれらのライブラリを指定しようとしましたが、それでも失敗しました。

LIBS += -lwinscard -lpcsclite WinSCard.Lib
4

3 に答える 3

1

しばらく経ちましたが、リーダーに付属している例のヘッダーを使用して、これを解決することができました。私の.proファイルは次のようになります


win32 { 
    HEADERS += MainWindow.h \
        ReadCard.h \
        Config.h
    INCLUDEPATH += C:/Omnikey/Include
    LIBS += C:/Omnikey/Lib/winscardn.lib
}
unix { 
    HEADERS += MainWindow.h \
        wintypes.h \
        winscard.h \
        reader.h \
        pcsclite.h \
        ReadCard.h \
        Config.h
    LIBS += -lpcsclite
}

このソリューションが他のタイプのリーダーで使用できるかどうかはわかりませんが、それは確かに私の解決策です。

于 2010-01-16T04:39:38.593 に答える
1

Theoretically speaking, pcsc-lite is a port of Windows PC/SC stack to UNIX machines. Windows PC/SC implementation is the "reference implementation" which pcsc-lite mimics. Not all Windows SCard functions are implemented in pcsc-lite and there are even minor differences, documented in pcsc-lite documentation

Don't know about the Qt specifics, but some notes:

  • pcsc_stringify_error is a pcsc-lite specific function. It does not exist in Windows
  • there is no pcsclite library on Windows or mingw, so you probably need different build files for Windows.
  • have a look at OpenSC and how it makes use of PC/SC(-lite) and if you're building with mingw, have a look at the "build" project. internal-winscard.h from OpenSC might be of interest to you as well.

Except for the pcsc_stringify_error, your problems are with generic Windows linking and Qt (qmake?) build system.

于 2009-11-22T16:21:59.233 に答える
0

Windows SDKのwinscardをminGWコンパイラと一緒に使用できないという同じ問題に遭遇しました。簡単な修正は、minGW の代わりに MSVC++ コンパイラ (コース外でアクセスできる場合) を使用することです (MSVC++ コンパイラも使用して Qt 自体をビルドする必要があります)。

おそらくこれをminGWで動作させることも可能ですが、それ以上は調べませんでした..

于 2010-01-02T15:23:15.593 に答える