1

We use mingw in out Qt projects on Windows. When we try to use PCSC library, we get an exception trying to connect to the smart card reader. We do not experience this problem when we use MSVC. Yet, we do not want to change the whole architecture just for this issue. The error message we get is:

error: undefined reference to `_imp__g_rgSCardT0Pci'

How can we solve this problem?

The problem appeared to be 64 bit winscard.lib library.

  • 1
    Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Paul R May 16 '17 at 08:19
  • Unfortunately this does not solve the issue. I found one post on internet stating that this is a bug of mingw. Yet I do not know the solution. – barbarossa1900 May 17 '17 at 08:37
  • One possible solution here: https://sourceforge.net/p/mingw-w64/discussion/723797/thread/d2624db4/ – Paul R May 17 '17 at 08:43
  • And another possible duplicate (with solution) here: http://stackoverflow.com/questions/27764653/error-lnk2019-unresolved-external-symbol-scardestablishcontext16-referenced-i – Paul R May 17 '17 at 08:44
  • I checked both of the links. The first one requires me to rebuild mingw libraries, if I'm not mistaken. The second one requires me to link WinSCard.lib library. Below I share a snippet from my project file. I already link to WinSCard.lib library. `LIBS += C:\pcsc-windows\Lib\WinSCard.Lib INCLUDEPATH += Z:/Workspace/Cpp/Producs/pw-websigner-v2/include \ C:\openssl-mingw-x86\include ` – barbarossa1900 May 17 '17 at 12:54
  • 2
    I finally solved the problem. The problem has to do with the 32 bit architecture of the project. We tried to link to 64 bit winscard.lib This caused the problem. I found the answer on an unrelated web page. Thanks again for the answers. – barbarossa1900 May 21 '17 at 15:57

0 Answers0