How to make Qwt shared library without libQtGui abd libQtCore



  • I have project in which I have to make

    1. Use Static library of libQtGui.a and libQtCore.a
    2. I have source code of qwt and while making shared libraries of qwt , I want to prevent qmake from linking to QtCore and QtGui . Basically I want qwt should build without QtGui and QtCore

    At the end I will be linking all together in my final executable

    1. Static libraries of libQtGui.a
    2. Static library of libQtCore.a
    3. Dynamic library of qwt. So as mentioned in color text

    I tried to give

    CONFIG -= gui core
    LIBS -= -lQtGui –lQtCore

    But I am not able to achive the results . It will be helpful if you could provide your inputs on the same



  • I believe you asked this question before.

    Dynamic linking is the answer to this problem. You have multiple executable's that require QtGui and QtCore so having one set of these as dynamic libraries that are loaded as needed makes sense.

    If you want to statically link these to your executable's you will have duplicate copies in all executable's that require them. You will, of course, increase the size of your application by including the extra duplicated copies.

    If you want to have qwt statically link QtGui and QtCore and then, somehow, use that specific copy in other executable's I think you are out of luck. Imported functions does not automatically become exported functions that can be used elsewhere.

    If you have the source code to all of this you might be able to turn it into one single executable statically linking to everything you need (?). You would really need to be serious about having a single executable if you want to go in this route.

    I, personally, wouldn't do this. Don't static link to QtGui, QtCore, or 'qwt' (whatever that is) and everything should work out well. So what if you end up with a few extra library files.


  • Lifetime Qt Champion


  • Qt Champions 2016

    @Qt-Enthusiast said in how to make qwt shared library without libQtGui abd libQtCore:

    I have source code of qwt and while making shared libraries of qwt , I want to prevent qmake from linking to QtCore and QtGui . Basically I want qwt should build without QtGui and QtCore

    Not possible even by a long shot.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.