Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Qmake problem / PCSC-Lite
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Qmake problem / PCSC-Lite

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 4.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    moon panda
    wrote on last edited by
    #1

    Hey,
    I really need some help with my makefiles.
    I am working on a tool which has a qt gui and communicates with a smartcard reader.
    Because I am working on Linux, i use PCSC-Lite.
    My problem is, in oder to get it to work, you need to include some lines into the makefile.

    The source is "http://ludovicrousseau.blogspot.de/2010/04/pcsc-sample-in-c.html":http://ludovicrousseau.blogspot.de/2010/04/pcsc-sample-in-c.html
    @

    Linux

    PCSC_CFLAGS := $(shell pkg-config --cflags libpcsclite)
    LDFLAGS := $(shell pkg-config --libs libpcsclite)

    Mac OS X

    #PCSC_CFLAGS := -framework PCSC

    CFLAGS += $(PCSC_CFLAGS)

    sample: sample.c

    clean:
    rm -f sample
    @

    So I tried to work with qmake but I couldn't get it to work. So I wrote a Makefile without qmake.

    So this is my own makefile.

    @

    QTDIR=/usr/share/qt4
    INCL+= -I $(QTDIR)/include -I $(QTDIR)/include/Qt
    -I $(QTDIR)/include/QtGui
    -I $(QTDIR)/include/QtCore
    MOC=$(QTDIR)/bin/moc
    QT+= core

    Linux

    PCSC_CFLAGS := $(shell pkg-config --cflags libpcsclite)
    LDFLAGS := $(shell pkg-config --libs libpcsclite)

    Mac OS X

    #PCSC_CFLAGS := -framework PCSC

    CFLAGS += $(PCSC_CFLAGS)

    PROG = Smartcardreader
    OBJS = main.o
    mainwindow.o
    pcsc.o

    LIBS = -lQtGui -lQtCore

    $(PROG): $(OBJS)
    #$(CXX) -o $(PROG) $(OBJS) $(LIBS)
    $(CXX) -o $(PROG) $(OBJS) $(LIBS) $(CFLAGS) $(LDFLAGS)

    clean:
    $(RM) $(OBJS) moc_*.cpp
    rm −f main.o mainwindow.o pcsc.o

    main.o: main.cpp mainwindow.h
    pcsc.h
    mainwindow.o: mainwindow.cpp pcsc.h
    pcsc.o: pcsc.cpp

    %.o: %.cpp
    $(CXX) -c $(CFLAGS) $(INCL) $*.cpp

    moc_%.cpp: %.h
    $(MOC) $(INCL) $.h -o moc_$.cpp
    @

    Here is my error massage if i try to compile it with qmake and than make
    @
    g++ -Wl,-O1 -o Smartcardreader main.o mainwindow.o pcsc.o -L/usr/lib/i386-linux-gnu -lQtGui -lQtCore -lpthread
    pcsc.o: In function pcsc::example()': pcsc.cpp:(.text+0x115): undefined reference to SCardEstablishContext'
    pcsc.cpp:(.text+0x143): undefined reference to SCardListReaders' pcsc.cpp:(.text+0x160): undefined reference to pcsc_stringify_error'
    pcsc.cpp:(.text+0x1c0): undefined reference to SCardListReaders' pcsc.cpp:(.text+0x1dd): undefined reference to pcsc_stringify_error'
    pcsc.cpp:(.text+0x249): undefined reference to SCardConnect' pcsc.cpp:(.text+0x266): undefined reference to pcsc_stringify_error'
    pcsc.cpp:(.text+0x29d): undefined reference to g_rgSCardT0Pci' pcsc.cpp:(.text+0x2a3): undefined reference to g_rgSCardT0Pci'
    pcsc.cpp:(.text+0x2b6): undefined reference to g_rgSCardT1Pci' pcsc.cpp:(.text+0x2bc): undefined reference to g_rgSCardT1Pci'
    pcsc.cpp:(.text+0x355): undefined reference to SCardDisconnect' pcsc.cpp:(.text+0x372): undefined reference to pcsc_stringify_error'
    pcsc.cpp:(.text+0x3a4): undefined reference to SCardFreeMemory' pcsc.cpp:(.text+0x3c1): undefined reference to pcsc_stringify_error'
    pcsc.cpp:(.text+0x3e6): undefined reference to SCardReleaseContext' pcsc.cpp:(.text+0x403): undefined reference to pcsc_stringify_error'
    pcsc.cpp:(.text+0x510): undefined reference to SCardTransmit' pcsc.cpp:(.text+0x524): undefined reference to pcsc_stringify_error'
    pcsc.cpp:(.text+0x6f7): undefined reference to SCardTransmit' pcsc.cpp:(.text+0x714): undefined reference to pcsc_stringify_error'
    pcsc.cpp:(.text+0x903): undefined reference to SCardTransmit' pcsc.cpp:(.text+0x917): undefined reference to pcsc_stringify_error'
    collect2: ld returned 1 exit status
    make: *** [Smartcardreader] Error 1

    @

    Now i got a problem with my Q_OBJECT and i would like to have my qmake working.

    My knowledge about makefiles is very little and I have problems including my pcsc libaries in qmake.
    Can someone please helpt me?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Add

      @
      CONFIG += link_pkgconfig
      PKGCONFIG += libpcsclite
      @

      To your pro file and you should be good to go

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        moon panda
        wrote on last edited by
        #3

        It's working :)
        Thanks a lot

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You're welcome !

          Since you have it building now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

          Happy coding !

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved