I have shared library(.so file) and I want to add that file into Qt .pro file.
How can I do it?
You should use the LIBS variable as vahancho suggests:
LIBS += -lQtSolutions_SingleApplication-2.6
# and more:
unix:LIBS += -lQxtCore -lQxtWeb -lQxtNetwork -lQtSolutions_IOCompressor-2.3
CONFIG(release, debug|release) {
win32:LIBS += -lbfd -liberty -limagehlp
}
# and so on
http://qt-project.org/doc/qt-4.8/qmake-variable-reference.html#libs
Related
I installed libfreenect. I opened QT and began to coding. When I use libfreenect.h no error occurres. But when I use libfreenect.hpp, this error occurred:"error: libusb.h: No such file or directory"
contents of .pro file is:
QT += core
QT -= gui
CONFIG += c++11
TARGET = 12moharram
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../usr/local/lib/release/ -lfreenect
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../usr/local/lib/debug/ -lfreenect
else:unix: LIBS += -L$$PWD/../../../usr/local/lib/ -lfreenect
INCLUDEPATH += $$PWD/../../../usr/local/include
DEPENDPATH += $$PWD/../../../usr/local/include
Where is the problem?
Probably libfreenect.h and libfreenect.hpp are themselves including other files, for a reason that I cannot understand libfreenect.hpp is including libusb.h and libfreenect.h is not. Probably libusb.h is not in your INCLUDEPATH.
I would first try to find libusb.h, if it is not present install it (you will probably have to install libusb-dev (debian style). Once you are sure libsub.h is present make sure is in the INCLUDEPATH, in case change the INCLUDEPATH in your .pro file.
This should fix this specific problem but after you fix this there can be more, good luck.
I have included the headers in Qt for my project, but the compiler is still not able to identify the headers. Libraries once included created its own includepath and depend.
Any help appriciated:
`INCLUDEPATH += $$PWD/../HDE/x86.linux/include
DEPENDPATH += $$PWD/../HDE/x86.linux/include
unix:!macx: LIBS += -L$$PWD/../HDE/x86.linux/lib/ -lddskernel
INCLUDEPATH += $$PWD/../HDE/x86.linux/include
DEPENDPATH += $$PWD/../HDE/x86.linux/include
unix:!macx: LIBS += -L$$PWD/../HDE/x86.linux/examples/dcps/Tutorial/cpp/standalone/ -lsacpp_tutorial_types
INCLUDEPATH += $$PWD/../HDE/x86.linux/examples/dcps/Tutorial/cpp/standalone
DEPENDPATH += $$PWD/../HDE/x86.linux/examples/dcps/Tutorial/cpp/standalone
unix:!macx: LIBS += -L$$PWD/../../../usr/lib/i386-linux-gnu/ -lpthread
INCLUDEPATH += $$PWD/../../../usr/lib/i386-linux-gnu
DEPENDPATH += $$PWD/../../../usr/lib/i386-linux-gnu`
All you have to do is also include the path for the header files in .pro file.
for instance if the header file is at location /home/jack/Myproject
then just write the below in the .pro file
INCLUDEPATH +=$$PWD/../Myproject
I am trying to include the assimp library (http://assimp.sourceforge.net/main_doc.html) for importing assets into my QT project.
I managed to include it in VS2012 but not in QT.
The import wizard gives me this code:
unix|win32: LIBS += -L$$PWD/assimp--3.0.1270-sdk/lib/assimp_debug-dll_win32/ -lassimp
INCLUDEPATH += $$PWD/assimp--3.0.1270-sdk/include
DEPENDPATH += $$PWD/assimp--3.0.1270-sdk/include
win32: PRE_TARGETDEPS += $$PWD/assimp--3.0.1270-sdk/lib/assimp_debug-dll_win32/assimp.lib
else:unix: PRE_TARGETDEPS += $$PWD/assimp--3.0.1270-sdk/lib/assimp_debug-dll_win32/libassimp.a
When i build the code it throws this error
undefined reference to `Assimp::Importer::Importer()'
If i understand it right:
QT / VS2012
INCLUDEPATH =Include directories
LIBS = Library directories
PRE_TARGETDEPS=Additional dependancies
Do i have to manualy add the location off the .dll file into .pro or what am i missing?
The library is called mod.lib, I have used the following lines to link the library. I also include its header file. Not sure what is wrong, but it kept giving me the undefined reference errors of library's functions when I try to use them in the code.
win32: CONFIG (release, debug|release): LIBS += -LC:/Users/J/proj -lmod
INCLUDEPATH += C:/Users/J/proj
DEPENDPATH += C:/Users/J/proj
win32: PRE_TARGETDEPS += C:/Users/J/proj/mod.lib
Thanks for answering.
Use
LIBS += -L/C:/Users/J/proj -lmod
Instead of
LIBS += -LC:/Users/J/proj -lmod
The proper way for adding a library is
LIBS += -L/path/to -lyourmodule
what is the best way to add additional compiled libraries to my qt project ?
For example boost or poco libs ?
Thanks :)
If you're using the GCC compiler add something like this to the .pro file:
For Boost:
INCLUDEPATH += d:/Biblioteki/C++/boost/boost_1_44_0a
LIBPATH += d:/Biblioteki/C++/boost/boost_1_44_0a/stage/lib
LIBS += -lboost_system-mgw44-mt-d-1_44
LIBS += -lboost_filesystem-mgw44-mt-d-1_44
LIBS += -lboost_date_time-mgw44-mt-d-1_44
For Poco:
INCLUDEPATH += d:/Biblioteki/C++/Poco/poco-1.3.6p2-mingw-qt2/include
LIBPATH += d:/Biblioteki/C++/Poco/poco-1.3.6p2-mingw-qt2/lib
LIBS += -lPocoFoundationd
LIBS += -lPocoNetd
LIBS += -lPocoUtild
LIBS += -lPocoXML
INCLUDEPATH - is the location of directory with header files
LIBPATH - is the location of directory with *.a files
LIBS - contains list of libraries you want to use in your application