PDA

View Full Version : How to build shared library of Qwt ; prevent qmake from linking to QtCore and QtGUI



Techi3081
29th August 2016, 12:36
I have final executable myGUIExec; In which I will be linking separately libraries of QtCore and QtGui as libQtCore.a and libQtGui.a

Now My project requirement is to make shared libraries of Qwt and it should not link to QtCore and QtGui

I did following steps

in src.pro in file

QT -= core -gui

but I am getting compilation error as

qwt_abstract_scale_draw.cpp:14:18: fatal error: qmap.h: No such file or directory


WHat is correct way to make shared library of qwt.so and it should not link or contain code of QtCore and QtGUI

d_stranz
29th August 2016, 16:38
WHat is correct way to make shared library of qwt.so and it should not link or contain code of QtCore and QtGUI

You are confusing compiling with linking. Removing core and gui from your qmake settings means that qmake no longer knows where to find the header files from these modules, and so your program won't compile. Put them back into the QT setting.

Qwt requires QtCore and QtGui in order to be used at runtime. The Qwt shared library does not contain any code from these Qt modules, it loads the shared libraries at runtime. When you link the Qwt object files to build a Qwt shared library, you still need to tell it which Qt libraries contain the Qt classes and methods it uses. It doesn't drag any code in with it, but makes a notation that, for example, "QObject" is found in libQtCore.a and so forth.