Why Qt can't detect library from /usr/lib...
-
What's the problem with that ?
An alternative for you is to set the
LIBRARY_PATH
environment variable. -
-
-
@JonB Actually there is no problem. But I just faced another issue that is I created another library and when I include that by -llibraryname that just builds fine...
And why is that. As one(my 2nd library) got the path but other(1st library) can't....
!!!
Please reply.... -
Where's that library located ?
How are you linking to it ?
Do you have any flags set for it that is not set for the first one ? -
Where's that library located ?
How are you linking to it ?
Do you have any flags set for it that is not set for the first one ? -
As already asked, show your .pro file.
From what you wrote, you just added a new library to the list. So the folder was already added earlier.
-
#------------------------------------------------- # # Project created by QtCreator 2018-08-20T09:12:54 # #------------------------------------------------- QT += core gui widgets TARGET = help TEMPLATE = app # library for theme unix:!macx: LIBS += -lcprime unix:!macx: LIBS += -lcsys SOURCES += \ main.cpp \ help.cpp HEADERS += \ help.h FORMS += \ help.ui RESOURCES += \ icons.qrc # Disable warnings, enable threading support and c++11 CONFIG += thread silent build_all c++11 # Disable Debug on Release # CONFIG(release):DEFINES += QT_NO_DEBUG_OUTPUT # Build location BUILD_PREFIX = $$(CA_BUILD_DIR) isEmpty( BUILD_PREFIX ) { BUILD_PREFIX = ./build } MOC_DIR = $$BUILD_PREFIX/moc-qt5 OBJECTS_DIR = $$BUILD_PREFIX/obj-qt5 RCC_DIR = $$BUILD_PREFIX/qrc-qt5 UI_DIR = $$BUILD_PREFIX/uic-qt5 unix { isEmpty(PREFIX) { PREFIX = /usr } BINDIR = $$PREFIX/bin target.path = $$BINDIR desktop.path = $$PREFIX/share/applications/ desktop.files = "Help CoreApps.desktop" icons.path = $$PREFIX/share/coreapps/icons/ icons.files = icons/Help.svg INSTALLS += target icons desktop } DEFINES += QT_DEPRECATED_WARNINGS DEFINES += "HAVE_POSIX_OPENPT"
This is the .pro file of my application.
And my 1st libraryQT += widgets core network gui charts concurrent dbus TARGET = csys TEMPLATE = lib # disable all build warnings CONFIG += silent warn_on static # Disable Debug on Release #CONFIG(release):DEFINES += QT_NO_DEBUG_OUTPUT VERSION = 1.0.10 DEFINES += LIBCSYS_LIBRARY HEADERS += \ csys/cpu_info.h \ csys/disk_info.h \ csys/memory_info.h \ csys/network_info.h \ csys/process.h \ csys/process_info.h \ csys/system_info.h \ csys/command_util.h \ csys/file_util.h \ csys/format_util.h \ csys/battery.h \ csys/info_manager.h \ csys/upower.h \ csys/udisks2.h \ libcsys_global.h SOURCES += \ csys/cpu_info.cpp \ csys/disk_info.cpp \ csys/memory_info.cpp \ csys/network_info.cpp \ csys/process.cpp \ csys/process_info.cpp \ csys/system_info.cpp \ csys/command_util.cpp \ csys/file_util.cpp \ csys/format_util.cpp \ csys/battery.cpp \ csys/info_manager.cpp \ csys/upower.cpp \ csys/udisks2.cpp MOC_DIR = ../build/moc OBJECTS_DIR = ../build/obj RCC_DIR = ../build/qrc UI_DIR = ../build/uic unix { isEmpty(PREFIX) { PREFIX = /usr } INSTALLS += target includes CONFIG += create_pc no_install_prl link_pkgconfig contains(DEFINES, LIB64): target.path = $$INSTALL_PREFIX/lib64 else: target.path = $$INSTALL_PREFIX/lib target.path = $$PREFIX/lib/ includes.files = libcsys_global.h csys/*.h includes.path = $$PREFIX/include/csys QMAKE_PKGCONFIG_NAME = libcsys QMAKE_PKGCONFIG_DESCRIPTION = Library for coreapps QMAKE_PKGCONFIG_PREFIX = $$INSTALL_PREFIX QMAKE_PKGCONFIG_LIBDIR = $$target.path QMAKE_PKGCONFIG_INCDIR = $$includes.path QMAKE_PKGCONFIG_VERSION = $$VERSION QMAKE_PKGCONFIG_DESTDIR = pkgconfig }
And 2nd Library is
QT += widgets core gui TARGET = cprime TEMPLATE = lib # disable all build warnings CONFIG += silent warn_on thread silent build_all c++11 DEFINES += LIBCPRIME_LIBRARY INCLUDEPATH += ./cprime/ DEPENDPATH += ./cprime/ # Disable Debug on Release #CONFIG(release):DEFINES += QT_NO_DEBUG_OUTPUT VERSION = 1.1.1 DEFINES += LIBCPRIME_LIBRARY MOC_DIR = ../build/moc OBJECTS_DIR = ../build/obj RCC_DIR = ../build/qrc UI_DIR = ../build/uic unix { isEmpty(PREFIX) { PREFIX = /usr } INSTALLS += target includes data themefiles CONFIG += create_pc no_install_prl link_pkgconfig contains(DEFINES, LIB64): target.path = $$INSTALL_PREFIX/lib64 else: target.path = $$INSTALL_PREFIX/lib target.path = $$PREFIX/lib/ includes.files = cprime/*.h libcprime_global.h includes.path = $$PREFIX/include/cprime/ data.path = $$PREFIX/share/coreapps/docs data.files = docs/Changelog docs/LICENSE docs/To-Do.txt themefiles.path = $$PREFIX/share/coreapps/Theme themefiles.files = style/*.qss style/*.ini QMAKE_PKGCONFIG_NAME = libcprime QMAKE_PKGCONFIG_DESCRIPTION = Library for coreapps QMAKE_PKGCONFIG_PREFIX = $$INSTALL_PREFIX QMAKE_PKGCONFIG_LIBDIR = $$target.path QMAKE_PKGCONFIG_INCDIR = $$includes.path QMAKE_PKGCONFIG_VERSION = $$VERSION QMAKE_PKGCONFIG_DESTDIR = pkgconfig } HEADERS += \ cprime/globalfunctions.h \ cprime/utilities.h \ cprime/settingsmanage.h \ cprime/bookmarkmanage.h \ cprime/bookmarkdialog.h \ libcprime_global.h \ SOURCES += \ cprime/globalfunctions.cpp \ cprime/utilities.cpp \ cprime/settingsmanage.cpp \ cprime/bookmarkmanage.cpp \ cprime/bookmarkdialog.cpp FORMS += \ cprime/bookmarkdialog.ui
-
Did you check whether you have these libraires in multiple places on your system ?
-
#------------------------------------------------- # # Project created by QtCreator 2018-08-20T09:12:54 # #------------------------------------------------- QT += core gui widgets TARGET = help TEMPLATE = app # library for theme unix:!macx: LIBS += -lcprime unix:!macx: LIBS += -lcsys SOURCES += \ main.cpp \ help.cpp HEADERS += \ help.h FORMS += \ help.ui RESOURCES += \ icons.qrc # Disable warnings, enable threading support and c++11 CONFIG += thread silent build_all c++11 # Disable Debug on Release # CONFIG(release):DEFINES += QT_NO_DEBUG_OUTPUT # Build location BUILD_PREFIX = $$(CA_BUILD_DIR) isEmpty( BUILD_PREFIX ) { BUILD_PREFIX = ./build } MOC_DIR = $$BUILD_PREFIX/moc-qt5 OBJECTS_DIR = $$BUILD_PREFIX/obj-qt5 RCC_DIR = $$BUILD_PREFIX/qrc-qt5 UI_DIR = $$BUILD_PREFIX/uic-qt5 unix { isEmpty(PREFIX) { PREFIX = /usr } BINDIR = $$PREFIX/bin target.path = $$BINDIR desktop.path = $$PREFIX/share/applications/ desktop.files = "Help CoreApps.desktop" icons.path = $$PREFIX/share/coreapps/icons/ icons.files = icons/Help.svg INSTALLS += target icons desktop } DEFINES += QT_DEPRECATED_WARNINGS DEFINES += "HAVE_POSIX_OPENPT"
This is the .pro file of my application.
And my 1st libraryQT += widgets core network gui charts concurrent dbus TARGET = csys TEMPLATE = lib # disable all build warnings CONFIG += silent warn_on static # Disable Debug on Release #CONFIG(release):DEFINES += QT_NO_DEBUG_OUTPUT VERSION = 1.0.10 DEFINES += LIBCSYS_LIBRARY HEADERS += \ csys/cpu_info.h \ csys/disk_info.h \ csys/memory_info.h \ csys/network_info.h \ csys/process.h \ csys/process_info.h \ csys/system_info.h \ csys/command_util.h \ csys/file_util.h \ csys/format_util.h \ csys/battery.h \ csys/info_manager.h \ csys/upower.h \ csys/udisks2.h \ libcsys_global.h SOURCES += \ csys/cpu_info.cpp \ csys/disk_info.cpp \ csys/memory_info.cpp \ csys/network_info.cpp \ csys/process.cpp \ csys/process_info.cpp \ csys/system_info.cpp \ csys/command_util.cpp \ csys/file_util.cpp \ csys/format_util.cpp \ csys/battery.cpp \ csys/info_manager.cpp \ csys/upower.cpp \ csys/udisks2.cpp MOC_DIR = ../build/moc OBJECTS_DIR = ../build/obj RCC_DIR = ../build/qrc UI_DIR = ../build/uic unix { isEmpty(PREFIX) { PREFIX = /usr } INSTALLS += target includes CONFIG += create_pc no_install_prl link_pkgconfig contains(DEFINES, LIB64): target.path = $$INSTALL_PREFIX/lib64 else: target.path = $$INSTALL_PREFIX/lib target.path = $$PREFIX/lib/ includes.files = libcsys_global.h csys/*.h includes.path = $$PREFIX/include/csys QMAKE_PKGCONFIG_NAME = libcsys QMAKE_PKGCONFIG_DESCRIPTION = Library for coreapps QMAKE_PKGCONFIG_PREFIX = $$INSTALL_PREFIX QMAKE_PKGCONFIG_LIBDIR = $$target.path QMAKE_PKGCONFIG_INCDIR = $$includes.path QMAKE_PKGCONFIG_VERSION = $$VERSION QMAKE_PKGCONFIG_DESTDIR = pkgconfig }
And 2nd Library is
QT += widgets core gui TARGET = cprime TEMPLATE = lib # disable all build warnings CONFIG += silent warn_on thread silent build_all c++11 DEFINES += LIBCPRIME_LIBRARY INCLUDEPATH += ./cprime/ DEPENDPATH += ./cprime/ # Disable Debug on Release #CONFIG(release):DEFINES += QT_NO_DEBUG_OUTPUT VERSION = 1.1.1 DEFINES += LIBCPRIME_LIBRARY MOC_DIR = ../build/moc OBJECTS_DIR = ../build/obj RCC_DIR = ../build/qrc UI_DIR = ../build/uic unix { isEmpty(PREFIX) { PREFIX = /usr } INSTALLS += target includes data themefiles CONFIG += create_pc no_install_prl link_pkgconfig contains(DEFINES, LIB64): target.path = $$INSTALL_PREFIX/lib64 else: target.path = $$INSTALL_PREFIX/lib target.path = $$PREFIX/lib/ includes.files = cprime/*.h libcprime_global.h includes.path = $$PREFIX/include/cprime/ data.path = $$PREFIX/share/coreapps/docs data.files = docs/Changelog docs/LICENSE docs/To-Do.txt themefiles.path = $$PREFIX/share/coreapps/Theme themefiles.files = style/*.qss style/*.ini QMAKE_PKGCONFIG_NAME = libcprime QMAKE_PKGCONFIG_DESCRIPTION = Library for coreapps QMAKE_PKGCONFIG_PREFIX = $$INSTALL_PREFIX QMAKE_PKGCONFIG_LIBDIR = $$target.path QMAKE_PKGCONFIG_INCDIR = $$includes.path QMAKE_PKGCONFIG_VERSION = $$VERSION QMAKE_PKGCONFIG_DESTDIR = pkgconfig } HEADERS += \ cprime/globalfunctions.h \ cprime/utilities.h \ cprime/settingsmanage.h \ cprime/bookmarkmanage.h \ cprime/bookmarkdialog.h \ libcprime_global.h \ SOURCES += \ cprime/globalfunctions.cpp \ cprime/utilities.cpp \ cprime/settingsmanage.cpp \ cprime/bookmarkmanage.cpp \ cprime/bookmarkdialog.cpp FORMS += \ cprime/bookmarkdialog.ui
-
That's not installed anywhere else. But the thing is, i found this problem on xubuntu 18.04 at Qt 5.9. But i tried this on Ubuntu 18.04 at Qt 5.9 and it works without typing
-L/usr/lib
i think i have to use-L/usr/lib
for me...
And i found my solution. Like
LIBS += -L/usr/lib -llibraryname
Thanks all of you...