gpt4 book ai didi

windows - Windows 上的 PCSC-Lite 代码

转载 作者:可可西里 更新时间:2023-11-01 10:30:31 25 4
gpt4 key购买 nike

我已经成功地构建了一个程序,可以在 Linux 上使用 Qt 读取 Mifare 1K 卡。所以现在,我希望它能在 Windows 上运行。据我所知,Windows 上没有 PCSC-Lite 端口,我需要使用 Windows SDK 中的 winscard。我已经下载了它,但我在 Windows 中(使用 MingW)从我的 Qt 中得到了很多 undefined reference 错误。例如:

release/ReadCard.o:ReadCard.cpp:(.text+0x48e): undefined reference to `pcsc_stringify_error'release/ReadCard.o:ReadCard.cpp:(.text+0x5e9): undefined reference to `pcsc_stringify_error'release/ReadCard.o:ReadCard.cpp:(.text+0x7ed): undefined reference to `pcsc_stringify_error'release/ReadCard.o:ReadCard.cpp:(.text+0x2e56): undefined reference to `SCardListReaderGroups'release/ReadCard.o:ReadCard.cpp:(.text+0x3adc): undefined reference to `SCardListReaders'release/ReadCard.o:ReadCard.cpp:(.text+0x3cc6): undefined reference to `SCardListReaders'release/ReadCard.o:ReadCard.cpp:(.text+0x3f88): undefined reference to `SCardGetStatusChange'release/ReadCard.o:ReadCard.cpp:(.text+0x4274): undefined reference to `SCardConnect'release/ReadCard.o:ReadCard.cpp:(.text+0x4d1b): undefined reference to `SCardGetStatusChange

我也试过在项目中指定这些库,但还是失败了。

LIBS += -lwinscard -lpcsclite WinSCard.Lib

最佳答案

从理论上讲,pcsc-lite 是 Windows PC/SC 堆栈到 UNIX 机器的端口。 Windows PC/SC 实现是 pcsc-lite 模仿的“引用实现”。并非所有 Windows SCard 功能都在 pcsc-lite 中实现,甚至存在细微差别,记录在 pcsc-lite documentation

不知道 Qt 的细节,但有一些注意事项:

  • pcsc_stringify_error 是 pcsc-lite 特定的函数。它在 Windows 中不存在
  • Windows 或 mingw 上没有 pcsclite 库,因此您可能需要针对 Windows 的不同构建文件。
  • 看看 OpenSC 及其工作原理 makes use of PC/SC(-lite ) 如果您使用 mingw 进行构建,请查看 "build" project . internal-winscard.h您可能也会对 OpenSC 感兴趣。

除了 pcsc_stringify_error,您的问题与通用 Windows 链接和 Qt(qmake?)构建系统有关。

关于windows - Windows 上的 PCSC-Lite 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1777713/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com