Spdlog library can't open in the Qt.
-
Hi,
Are you sure that these libs are static ? A .lib file can either be a static library or import library that will require the use of a dll at run time.
wrote on 24 Aug 2021, 18:07 last edited by@SGaist said in Spdlog library can't open in the Qt.:
Are you sure that these libs are static ? A .lib file can either be a static library or import library that will require the use of a dll at run time.
The spdlog library is either header-only or static.
-
Do you have it working if you copy the code of the examples in the library documentation (without any Qt stuff) ?
-
@SGaist
The problem is in the spdlog::info function line. When I delete this line, I don't get errors.wrote on 24 Aug 2021, 19:33 last edited by@Enes-Alp said in Spdlog library can't open in the Qt.:
The problem is in the spdlog::info function line
Have you tried the header-only approach?
-
wrote on 24 Aug 2021, 22:04 last edited by
Yes, I tried but I get the same result.
#include <spdlog/spdlog.h> int main() { spdlog::info("Welcome to spdlog"); return 0; }
QT -= gui CONFIG += c++11 console CONFIG -= app_bundle ##- spdlog installed by default c:/dev/vcpkg SPDLOG_ROOT = c:/dev/vcpkg/installed/x64-windows exists($$SPDLOG_ROOT) { LIBS += -L$$SPDLOG_ROOT/lib -lspdlog -lfmt INCLUDEPATH += $$SPDLOG_ROOT/include DEPENDPATH += $$SPDLOG_ROOT/include DESTDIR_WIN = $$replace(DESTDIR, "/", "\\") SPDLOG_ROOT_WIN = $$replace(SPDLOG_ROOT, "/", "\\") } # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target `
-
Yes, I tried but I get the same result.
#include <spdlog/spdlog.h> int main() { spdlog::info("Welcome to spdlog"); return 0; }
QT -= gui CONFIG += c++11 console CONFIG -= app_bundle ##- spdlog installed by default c:/dev/vcpkg SPDLOG_ROOT = c:/dev/vcpkg/installed/x64-windows exists($$SPDLOG_ROOT) { LIBS += -L$$SPDLOG_ROOT/lib -lspdlog -lfmt INCLUDEPATH += $$SPDLOG_ROOT/include DEPENDPATH += $$SPDLOG_ROOT/include DESTDIR_WIN = $$replace(DESTDIR, "/", "\\") SPDLOG_ROOT_WIN = $$replace(SPDLOG_ROOT, "/", "\\") } # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target `
wrote on 25 Aug 2021, 06:32 last edited by@Enes-Alp said in Spdlog library can't open in the Qt.:
Yes, I tried but I get the same result.
But you don't have change anything, so the result will still be the same.
Header only approach means you add each spdlog header file inINCLUDES
and removespdlog
fromLIBS
. -
@Enes-Alp said in Spdlog library can't open in the Qt.:
Yes, I tried but I get the same result.
But you don't have change anything, so the result will still be the same.
Header only approach means you add each spdlog header file inINCLUDES
and removespdlog
fromLIBS
.wrote on 25 Aug 2021, 10:01 last edited byThe Header-only approach is working but how can I add a static link?
INCLUDEPATH += C:/Users/enesa/Documents/Test-Qt-Cpp/include/spdlog/include
-
The concept of header only librairies is that you do not have anything to link.
-
The header only library means that you do not have to link anything but this means that you will build everything you use from it on each build.
20/20