Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Spdlog library can't open in the Qt.
Forum Updated to NodeBB v4.3 + New Features

Spdlog library can't open in the Qt.

Scheduled Pinned Locked Moved Solved 3rd Party Software
20 Posts 5 Posters 3.6k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Enes Alp
    wrote on last edited by
    #3

    yes I tried the debug and release mode? Also I'm using msvc2019-64bit but when I changed the mingw, I get some linker error.
    URL require for qml side.

    KroMignonK 1 Reply Last reply
    0
    • E Enes Alp

      yes I tried the debug and release mode? Also I'm using msvc2019-64bit but when I changed the mingw, I get some linker error.
      URL require for qml side.

      KroMignonK Offline
      KroMignonK Offline
      KroMignon
      wrote on last edited by
      #4

      @Enes-Alp said in Spdlog library can't open in the Qt.:

      I'm using msvc2019-64bit but when I changed the mingw, I get some linker error.

      If you change Qt Kit from MSVC2019-64bit to mingw, you also have to use a compatible spdlog and fmt build version.

      I guess the problem is in the QML code / import path.
      Try to set the environment variable QML_IMPORT_TRACE to got QML traces.
      You can do it in code, like this:

      int main(int argc, char *argv[]) {
      #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
        QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
      #endif
      
        qputenv("QML_IMPORT_TRACE", "1");
        QGuiApplication app(argc, argv);
      
        QQmlApplicationEngine engine;
        engine.addImportPath("qrc:/");
        const QUrl url(QStringLiteral("qrc:/views/MasterView.qml"));
        engine.load(url);
      
        return app.exec();
      }
      

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Enes Alp
        wrote on last edited by
        #5

        The problem is with spd functions.
        When I added the below code, I get a crash.

        spdlog::info("....");
        
        KroMignonK 1 Reply Last reply
        0
        • E Enes Alp

          The problem is with spd functions.
          When I added the below code, I get a crash.

          spdlog::info("....");
          
          KroMignonK Offline
          KroMignonK Offline
          KroMignon
          wrote on last edited by
          #6

          @Enes-Alp said in Spdlog library can't open in the Qt.:

          The problem is with spd functions.
          When I added the below code, I get a crash

          How did you build spdlog library?
          Did you use same compiler (MSVC2019-64bit)?

          It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

          1 Reply Last reply
          0
          • E Offline
            E Offline
            Enes Alp
            wrote on last edited by Enes Alp
            #7

            I installed with vcpkg like this ./vcpkg.exe install spdlog:x64-windows. I didn't compile because the spdlog has static compilation files(spdlog.lib, fmt.lib). I added just include and .lib files.

            ##- 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, "/", "\\")
            }
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #8

              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.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              JohanSoloJ 1 Reply Last reply
              0
              • E Offline
                E Offline
                Enes Alp
                wrote on last edited by
                #9

                I don't have any dll file in the lib folder.

                8ccd8a33-5464-4171-9708-b5a2cf54b7f5-image.png

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  Then start your application through the debugger to get a stack trace of the crash.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  E 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    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.

                    JohanSoloJ Offline
                    JohanSoloJ Offline
                    JohanSolo
                    wrote on last edited by
                    #11

                    @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.

                    `They did not know it was impossible, so they did it.'
                    -- Mark Twain

                    1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Then start your application through the debugger to get a stack trace of the crash.

                      E Offline
                      E Offline
                      Enes Alp
                      wrote on last edited by
                      #12

                      @SGaist
                      The problem is in the spdlog::info function line. When I delete this line, I don't get errors.

                      Pablo J. RoginaP 1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #13

                        Do you have it working if you copy the code of the examples in the library documentation (without any Qt stuff) ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • E Enes Alp

                          @SGaist
                          The problem is in the spdlog::info function line. When I delete this line, I don't get errors.

                          Pablo J. RoginaP Offline
                          Pablo J. RoginaP Offline
                          Pablo J. Rogina
                          wrote on last edited by
                          #14

                          @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?

                          Upvote the answer(s) that helped you solve the issue
                          Use "Topic Tools" button to mark your post as Solved
                          Add screenshots via postimage.org
                          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                          1 Reply Last reply
                          0
                          • E Offline
                            E Offline
                            Enes Alp
                            wrote on last edited by
                            #15

                            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
                            `
                            
                            KroMignonK 1 Reply Last reply
                            0
                            • E Enes Alp

                              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
                              `
                              
                              KroMignonK Offline
                              KroMignonK Offline
                              KroMignon
                              wrote on last edited by
                              #16

                              @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 in INCLUDES and remove spdlog from LIBS.

                              It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                              E 1 Reply Last reply
                              0
                              • KroMignonK KroMignon

                                @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 in INCLUDES and remove spdlog from LIBS.

                                E Offline
                                E Offline
                                Enes Alp
                                wrote on last edited by
                                #17

                                @KroMignon

                                The Header-only approach is working but how can I add a static link?

                                INCLUDEPATH += C:/Users/enesa/Documents/Test-Qt-Cpp/include/spdlog/include
                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #18

                                  The concept of header only librairies is that you do not have anything to link.

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  E 1 Reply Last reply
                                  1
                                  • SGaistS SGaist

                                    The concept of header only librairies is that you do not have anything to link.

                                    E Offline
                                    E Offline
                                    Enes Alp
                                    wrote on last edited by
                                    #19

                                    @SGaist

                                    In the doc, the static lib version is much faster in compile time.
                                    What is the meaning of this, you know?

                                    dcd103a4-6988-4f41-a3a3-79558ac067c8-image.png

                                    1 Reply Last reply
                                    0
                                    • SGaistS Offline
                                      SGaistS Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #20

                                      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.

                                      Interested in AI ? www.idiap.ch
                                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      1 Reply Last reply
                                      0

                                      • Login

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • Users
                                      • Groups
                                      • Search
                                      • Get Qt Extensions
                                      • Unsolved