I made a Qt Project with two sub-projects. One is a static library, the other is the GUI app that uses the static library.
Since this is a sub-project project I have specified the order in which the two parts are built. Starting with the static library in the project tree and then the app in the project tree. Done with the CONFIG+=ordered option.
I also require a third external static library. Which is in a separate directory on my system. This library can be used statically or dynamically.
Normally to use this third external library with g++ you’d do:
g++ biohello.cpp \
-o biohello \
--static \
-I$bpp_dir/include \
-L$bpp_dir/lib \
-lbpp-seq -lbpp-core
strip biohello
for static compilation or for dynamic:
g++ biohello.cpp \
-o biohello \
-I$bpp_dir/include \
-L$bpp_dir/lib \
-lbpp-seq -lbpp-core
I’d like to include the library statically.
I’ve tried using the add library wizard of Creator which resulted in the addition of:
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../local/bpp/dev/lib/release/ -lbpp-seq
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../local/bpp/dev/lib/debug/ -lbpp-seq
else:unix: LIBS += -L$$PWD/../../local/bpp/dev/lib/ -lbpp-seq
INCLUDEPATH += $$PWD/../../local/bpp/dev/include
DEPENDPATH += $$PWD/../../local/bpp/dev/include
win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../local/bpp/dev/lib/release/libbpp-seq.a
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../local/bpp/dev/lib/debug/libbpp-seq.a
else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../local/bpp/dev/lib/release/bpp-seq.lib
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../local/bpp/dev/lib/debug/bpp-seq.lib
else:unix: PRE_TARGETDEPS += $$PWD/../../local/bpp/dev/lib/libbpp-seq.a
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../local/bpp/dev/lib/release/ -lbpp-core
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../local/bpp/dev/lib/debug/ -lbpp-core
else:unix: LIBS += -L$$PWD/../../local/bpp/dev/lib/ -lbpp-core
INCLUDEPATH += $$PWD/../../local/bpp/dev/include
DEPENDPATH += $$PWD/../../local/bpp/dev/include
win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../local/bpp/dev/lib/release/libbpp-core.a
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../local/bpp/dev/lib/debug/libbpp-core.a
else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../local/bpp/dev/lib/release/bpp-core.lib
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../local/bpp/dev/lib/debug/bpp-core.lib
else:unix: PRE_TARGETDEPS += $$PWD/../../local/bpp/dev/lib/libbpp-core.a
To the .pro files, hitting run makes the app run fine, but when I leave Creator and try to start the executable from my desktop or command line I’m told:
error while loading shared libraries: libbpp-seq.so.9: cannot open shared object file: No such file or directory
I haven’t – to my knowlege, tried to include any shared objects, what I’m looking to do is include the external library statically using Qt Creator to the same result as you would with the g++ snippet above.
Thanks,
Ben W.
↧