[SOLVED] Qmake problem / PCSC-Lite
-
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+= coreLinux
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.oLIBS = -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.omain.o: main.cpp mainwindow.h
pcsc.h
mainwindow.o: mainwindow.cpp pcsc.h
pcsc.o: pcsc.cpp%.o: %.cpp
$(CXX) -c $(CFLAGS) $(INCL) $*.cppmoc_%.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 functionpcsc::example()': pcsc.cpp:(.text+0x115): undefined reference to
SCardEstablishContext'
pcsc.cpp:(.text+0x143): undefined reference toSCardListReaders' pcsc.cpp:(.text+0x160): undefined reference to
pcsc_stringify_error'
pcsc.cpp:(.text+0x1c0): undefined reference toSCardListReaders' pcsc.cpp:(.text+0x1dd): undefined reference to
pcsc_stringify_error'
pcsc.cpp:(.text+0x249): undefined reference toSCardConnect' pcsc.cpp:(.text+0x266): undefined reference to
pcsc_stringify_error'
pcsc.cpp:(.text+0x29d): undefined reference tog_rgSCardT0Pci' pcsc.cpp:(.text+0x2a3): undefined reference to
g_rgSCardT0Pci'
pcsc.cpp:(.text+0x2b6): undefined reference tog_rgSCardT1Pci' pcsc.cpp:(.text+0x2bc): undefined reference to
g_rgSCardT1Pci'
pcsc.cpp:(.text+0x355): undefined reference toSCardDisconnect' pcsc.cpp:(.text+0x372): undefined reference to
pcsc_stringify_error'
pcsc.cpp:(.text+0x3a4): undefined reference toSCardFreeMemory' pcsc.cpp:(.text+0x3c1): undefined reference to
pcsc_stringify_error'
pcsc.cpp:(.text+0x3e6): undefined reference toSCardReleaseContext' pcsc.cpp:(.text+0x403): undefined reference to
pcsc_stringify_error'
pcsc.cpp:(.text+0x510): undefined reference toSCardTransmit' pcsc.cpp:(.text+0x524): undefined reference to
pcsc_stringify_error'
pcsc.cpp:(.text+0x6f7): undefined reference toSCardTransmit' pcsc.cpp:(.text+0x714): undefined reference to
pcsc_stringify_error'
pcsc.cpp:(.text+0x903): undefined reference toSCardTransmit' 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? -
Hi and welcome to devnet,
Add
@
CONFIG += link_pkgconfig
PKGCONFIG += libpcsclite
@To your pro file and you should be good to go
-
It's working :)
Thanks a lot -
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 !