[SOLVED]Linking Internal library with VERSION tag



  • Hi!

    I have dynamic library in my project. Let it be "SignalProcess". I added it to project with Qt Creator "Add library..." dialog
    Here what i got:

    win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../SignalProcess/release/ -lSignalProcess
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../SignalProcess/debug/ -lSignalProcess
    else:unix: LIBS += -L$$OUT_PWD/../SignalProcess/ -lSignalProcess
    
    INCLUDEPATH += $$PWD/../SignalProcess
    DEPENDPATH += $$PWD/../SignalProcess
    

    It works fine until adding VERSION = 0.5.0 to SignalProcess. After it, build ends with error:

    cannot find -lSignalProcess
    

    I am using Qt 5.4.1 with MinGW 4.9.1 32bit under Windows 8.1 x64

    How is it possible to fix this?



  • So, I found one solution:

    win32:CONFIG(release, debug|release): LIBS += -L$OUT_PWD/../SignalProcess/release/ -lSignalProcess$$VER_MAJ
    else:win32:CONFIG(debug, debug|release): LIBS += -L$OUT_PWD/../SignalProcess/debug/ -lSignalProcess$$VER_MAJ
    else:unix: LIBS += -L$OUT_PWD/../SignalProcess/ -lSignalProcess
    

    Unfortunately, for some reason, VER_MAJ is not setted, even if VERSION is setted.
    But, after adding VER_MAJ = 0 to .pro file, the application begins to compile.

    Could it be something better than this? And why VER_MAJ is not setted by qmake?



  • Hi,

    according to the doc VER_MAJ is set only for lib projects



  • Thanks for reply!

    Than, if I have project with subdirs, where one is lib with

    TARGET = SignalProcess
    TEMPLATE = lib
    VERSION = 0.5.0
    

    And other is application, why

    win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../SignalProcess/release/ -lSignalProcess
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../SignalProcess/debug/ -lSignalProcess
    else:unix: LIBS += -L$$OUT_PWD/../SignalProcess/ -lSignalProcess
    
    INCLUDEPATH += $$PWD/../SignalProcess
    DEPENDPATH += $$PWD/../SignalProcess
    

    does not work? (ends with "cannot find -lSignalProcess" error)



  • HI,

    in Windows the major_version became part of the library name, so you need to specify it when you want link the library



  • Ok, thank you!
    just a little bit confused, that qmake could not generate right makefile without support:)


Log in to reply
 

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