Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Dependencies missing after DLL compilation
QtWS25 Last Chance

Dependencies missing after DLL compilation

Scheduled Pinned Locked Moved Solved General and Desktop
dllcompilationqmakedependencieslabview
13 Posts 3 Posters 2.4k Views
  • 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.
  • U UvQtcYZJuD7J5VW7
    16 Mar 2022, 13:23

    Great, I don't have the dependency errors anymore. So, now, if I want to share my DLL, I need to give libgcc and libstd.

    But now, I still can't access to my DLL with LabView. To be sure that LabView is not the source of my problem, I made a little Qt App that load my DLL :
    main.cpp

    #include "mainwindow.h"
    
    #include <QApplication>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        MainWindow w; //useless, just to see the execution
        w.show();
    
        QLibrary lib;
        QString path = "C:/Users/xxxxx/Desktop/xxxxx/Qt/build-ProtoDLL2-Desktop_Qt_6_2_2_MinGW_32_bit-Release/release/ProtoDLL2.dll";
        a.addLibraryPath(path);
    
        if(QLibrary::isLibrary(path)) {
            lib.setFileName(path);
            lib.load();
            if(lib.isLoaded())
                qDebug() << "Ok\n";
            else
                qDebug() << "Error " << lib.errorString() << "\n";
        } else
            qDebug() << "Not a library\n";
        return a.exec();
    }
    

    When I run my app, the MainWindows appears and I get this message :

    Error  "Cannot load library C:\\Users\\xxxxx\\Desktop\\xxxxx\\Qt\\build-ProtoDLL2-Desktop_Qt_6_2_2_MinGW_32_bit-Release\\release\\ProtoDLL2.dll: Le module spécifié est introuvable." 
    

    that means in french : The specified module cannot be found.

    K Offline
    K Offline
    KroMignon
    wrote on 16 Mar 2022, 13:31 last edited by KroMignon
    #4

    @UvQtcYZJuD7J5VW7 said in Dependencies missing after DLL compilation:

    QString path = "C:/Users/xxxxx/Desktop/xxxxx/Qt/build-ProtoDLL2-Desktop_Qt_6_2_2_MinGW_32_bit-Release/release/ProtoDLL2.dll";
    a.addLibraryPath(path);
    

    I would change this to:

    QFileInfo f("C:/Users/xxxxx/Desktop/xxxxx/Qt/build-ProtoDLL2-Desktop_Qt_6_2_2_MinGW_32_bit-Release/release/ProtoDLL2.dll");
    a.addLibraryPath(f.absoluteDir());
    

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

    U 1 Reply Last reply 16 Mar 2022, 13:35
    0
    • K KroMignon
      16 Mar 2022, 13:31

      @UvQtcYZJuD7J5VW7 said in Dependencies missing after DLL compilation:

      QString path = "C:/Users/xxxxx/Desktop/xxxxx/Qt/build-ProtoDLL2-Desktop_Qt_6_2_2_MinGW_32_bit-Release/release/ProtoDLL2.dll";
      a.addLibraryPath(path);
      

      I would change this to:

      QFileInfo f("C:/Users/xxxxx/Desktop/xxxxx/Qt/build-ProtoDLL2-Desktop_Qt_6_2_2_MinGW_32_bit-Release/release/ProtoDLL2.dll");
      a.addLibraryPath(f.absoluteDir());
      
      U Offline
      U Offline
      UvQtcYZJuD7J5VW7
      wrote on 16 Mar 2022, 13:35 last edited by
      #5

      @KroMignon I just applied the changes you suggested but it doesn't seem to affect the loading of the DLL. I get the same error.

      K 1 Reply Last reply 16 Mar 2022, 13:40
      0
      • U UvQtcYZJuD7J5VW7
        16 Mar 2022, 13:35

        @KroMignon I just applied the changes you suggested but it doesn't seem to affect the loading of the DLL. I get the same error.

        K Offline
        K Offline
        KroMignon
        wrote on 16 Mar 2022, 13:40 last edited by
        #6

        @UvQtcYZJuD7J5VW7 said in Dependencies missing after DLL compilation:

        I just applied the changes you suggested but it doesn't seem to affect the loading of the DLL. I get the same error.

        AFAIK, QLibrary::isLibrary() only check if the filename is a valid name for a library, not if the file exists.
        Just in case of the path is wrong:

        QFileInfo f("C:/Users/xxxxx/Desktop/xxxxx/Qt/build-ProtoDLL2-Desktop_Qt_6_2_2_MinGW_32_bit-Release/release/ProtoDLL2.dll");
        
        if(!f.exists())
        {
            qDebug() << "File" << f. fileName() << "not found!";
        }
        a.addLibraryPath(f.absoluteDir());
        

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

        U 2 Replies Last reply 16 Mar 2022, 13:47
        0
        • K KroMignon
          16 Mar 2022, 13:40

          @UvQtcYZJuD7J5VW7 said in Dependencies missing after DLL compilation:

          I just applied the changes you suggested but it doesn't seem to affect the loading of the DLL. I get the same error.

          AFAIK, QLibrary::isLibrary() only check if the filename is a valid name for a library, not if the file exists.
          Just in case of the path is wrong:

          QFileInfo f("C:/Users/xxxxx/Desktop/xxxxx/Qt/build-ProtoDLL2-Desktop_Qt_6_2_2_MinGW_32_bit-Release/release/ProtoDLL2.dll");
          
          if(!f.exists())
          {
              qDebug() << "File" << f. fileName() << "not found!";
          }
          a.addLibraryPath(f.absoluteDir());
          
          U Offline
          U Offline
          UvQtcYZJuD7J5VW7
          wrote on 16 Mar 2022, 13:47 last edited by UvQtcYZJuD7J5VW7
          #7
          This post is deleted!
          1 Reply Last reply
          0
          • K KroMignon
            16 Mar 2022, 13:40

            @UvQtcYZJuD7J5VW7 said in Dependencies missing after DLL compilation:

            I just applied the changes you suggested but it doesn't seem to affect the loading of the DLL. I get the same error.

            AFAIK, QLibrary::isLibrary() only check if the filename is a valid name for a library, not if the file exists.
            Just in case of the path is wrong:

            QFileInfo f("C:/Users/xxxxx/Desktop/xxxxx/Qt/build-ProtoDLL2-Desktop_Qt_6_2_2_MinGW_32_bit-Release/release/ProtoDLL2.dll");
            
            if(!f.exists())
            {
                qDebug() << "File" << f. fileName() << "not found!";
            }
            a.addLibraryPath(f.absoluteDir());
            
            U Offline
            U Offline
            UvQtcYZJuD7J5VW7
            wrote on 16 Mar 2022, 14:03 last edited by
            #8

            @KroMignon Here the entire code of main.cpp
            When I run my app, I don't have the message that the DLL is non existing.
            And I replace absoluteDir() by filePath() because Qt Creator say Calling 'absoluteDir' with incomplete return type 'QDir'

            #include "mainwindow.h"
            
            #include <QApplication>
            
            int main(int argc, char *argv[])
            {
                QApplication a(argc, argv);
                MainWindow w;
                w.show();
            
                QLibrary lib;
                QFileInfo f("C:/Users/xxxxx/Desktop/xxxxx/Qt/build-ProtoDLL2-Desktop_Qt_6_2_2_MinGW_32_bit-Release/release/ProtoDLL2.dll");
            
                if(!f.exists()){
                    qDebug() << "file" << f.fileName() << "not found !";
                }
            
                a.addLibraryPath(f.absoluteDir());
            
                if(QLibrary::isLibrary(f.filePath())) {
                    lib.setFileName(f.filePath());
                    lib.load();
                    if(lib.isLoaded())
                        qDebug() << "Ok\n";
                    else
                        qDebug() << "Error " << lib.errorString() << "\n";
                } else
                    qDebug() << "Not a library\n";
                return a.exec();
            }
            

            Thanks for your help

            J 1 Reply Last reply 17 Mar 2022, 01:37
            0
            • U UvQtcYZJuD7J5VW7
              16 Mar 2022, 14:03

              @KroMignon Here the entire code of main.cpp
              When I run my app, I don't have the message that the DLL is non existing.
              And I replace absoluteDir() by filePath() because Qt Creator say Calling 'absoluteDir' with incomplete return type 'QDir'

              #include "mainwindow.h"
              
              #include <QApplication>
              
              int main(int argc, char *argv[])
              {
                  QApplication a(argc, argv);
                  MainWindow w;
                  w.show();
              
                  QLibrary lib;
                  QFileInfo f("C:/Users/xxxxx/Desktop/xxxxx/Qt/build-ProtoDLL2-Desktop_Qt_6_2_2_MinGW_32_bit-Release/release/ProtoDLL2.dll");
              
                  if(!f.exists()){
                      qDebug() << "file" << f.fileName() << "not found !";
                  }
              
                  a.addLibraryPath(f.absoluteDir());
              
                  if(QLibrary::isLibrary(f.filePath())) {
                      lib.setFileName(f.filePath());
                      lib.load();
                      if(lib.isLoaded())
                          qDebug() << "Ok\n";
                      else
                          qDebug() << "Error " << lib.errorString() << "\n";
                  } else
                      qDebug() << "Not a library\n";
                  return a.exec();
              }
              

              Thanks for your help

              J Offline
              J Offline
              JKSH
              Moderators
              wrote on 17 Mar 2022, 01:37 last edited by JKSH
              #9

              @UvQtcYZJuD7J5VW7 said in Dependencies missing after DLL compilation:

              I want to generate a shared library (DLL) with Qt functions (QWebsocket in particular) in 32 bits. This generated DLL will be used in LabView project (32 bits) with Call Library Function Node (CLFN).

              Before we go too far down this path, may I ask why you want to use QWebSocket instead of a native LabVIEW WebSocket library? https://www.vipm.io/search/?q=websocket

              But now, I still can't access to my DLL with LabView.

              Why not? What do you see when you configure the Call Library Function Node to use the DLL?

              Calling 'absoluteDir' with incomplete return type 'QDir'

              You need to #include <QDir>

              QString path = "C:/Users/xxxxx/Desktop/xxxxx/Qt/build-ProtoDLL2-Desktop_Qt_6_2_2_MinGW_32_bit-Release/release/ProtoDLL2.dll";
              a.addLibraryPath(path);
              

              addLibraryPath() is for adding a folder, not a DLL. See https://doc.qt.io/qt-6/qcoreapplication.html#addLibraryPath

              So, now, if I want to share my DLL, I need to give libgcc and libstd.

              Correct. And if your DLL uses Qt functions, then you must also provide the Qt DLLs.

              More importantly, note that:

              • The Qt features might depend on some plugins (for example, tls\qopensslbackend.dll). You need to call QCoreApplication::addLibraryPath() to specify where to find the plugins.
              • Many Qt classes, including QWebSocket, require a running event loop (in other words, QCoreApplication::exec() must be active). However, exec() blocks (doesn't return) until you quit().
              • Many Qt classes are not thread-safe. However, LabVIEW is implicitly multithreaded and can call your function from any thread.

              This means your DLL must start its own background std::thread and guarantee that the Qt class methods are called in in the correct thread.

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              U 1 Reply Last reply 17 Mar 2022, 08:25
              2
              • J JKSH
                17 Mar 2022, 01:37

                @UvQtcYZJuD7J5VW7 said in Dependencies missing after DLL compilation:

                I want to generate a shared library (DLL) with Qt functions (QWebsocket in particular) in 32 bits. This generated DLL will be used in LabView project (32 bits) with Call Library Function Node (CLFN).

                Before we go too far down this path, may I ask why you want to use QWebSocket instead of a native LabVIEW WebSocket library? https://www.vipm.io/search/?q=websocket

                But now, I still can't access to my DLL with LabView.

                Why not? What do you see when you configure the Call Library Function Node to use the DLL?

                Calling 'absoluteDir' with incomplete return type 'QDir'

                You need to #include <QDir>

                QString path = "C:/Users/xxxxx/Desktop/xxxxx/Qt/build-ProtoDLL2-Desktop_Qt_6_2_2_MinGW_32_bit-Release/release/ProtoDLL2.dll";
                a.addLibraryPath(path);
                

                addLibraryPath() is for adding a folder, not a DLL. See https://doc.qt.io/qt-6/qcoreapplication.html#addLibraryPath

                So, now, if I want to share my DLL, I need to give libgcc and libstd.

                Correct. And if your DLL uses Qt functions, then you must also provide the Qt DLLs.

                More importantly, note that:

                • The Qt features might depend on some plugins (for example, tls\qopensslbackend.dll). You need to call QCoreApplication::addLibraryPath() to specify where to find the plugins.
                • Many Qt classes, including QWebSocket, require a running event loop (in other words, QCoreApplication::exec() must be active). However, exec() blocks (doesn't return) until you quit().
                • Many Qt classes are not thread-safe. However, LabVIEW is implicitly multithreaded and can call your function from any thread.

                This means your DLL must start its own background std::thread and guarantee that the Qt class methods are called in in the correct thread.

                U Offline
                U Offline
                UvQtcYZJuD7J5VW7
                wrote on 17 Mar 2022, 08:25 last edited by
                #10

                @JKSH said in Dependencies missing after DLL compilation:

                Before we go too far down this path, may I ask why you want to use QWebSocket instead of a native LabVIEW WebSocket library? https://www.vipm.io/search/?q=websocket

                Of course, I prefer to use QWebSocket because on WebSocket connection, I serialize my data. My serializer doesn't work with LabView, it works with C++ Class, so for the next feature, it's better according to me to use QWebSocket.

                Why not? What do you see when you configure the Call Library Function Node to use the DLL?

                Here is my error screen from LabView :
                Capture.JPG
                I just put this code on my diagram :
                Capture.JPG
                With this configuration :
                Capture.JPG

                You need to #include <QDir>

                Obviously, I really need to familiarize myself with Qt ! But Qt Creator return me this error (in editor mode) : no viable conversion from 'QDir' to 'const QString'

                Thanks for your help, I continue to work on your last comment.

                J 1 Reply Last reply 17 Mar 2022, 09:13
                0
                • U UvQtcYZJuD7J5VW7
                  17 Mar 2022, 08:25

                  @JKSH said in Dependencies missing after DLL compilation:

                  Before we go too far down this path, may I ask why you want to use QWebSocket instead of a native LabVIEW WebSocket library? https://www.vipm.io/search/?q=websocket

                  Of course, I prefer to use QWebSocket because on WebSocket connection, I serialize my data. My serializer doesn't work with LabView, it works with C++ Class, so for the next feature, it's better according to me to use QWebSocket.

                  Why not? What do you see when you configure the Call Library Function Node to use the DLL?

                  Here is my error screen from LabView :
                  Capture.JPG
                  I just put this code on my diagram :
                  Capture.JPG
                  With this configuration :
                  Capture.JPG

                  You need to #include <QDir>

                  Obviously, I really need to familiarize myself with Qt ! But Qt Creator return me this error (in editor mode) : no viable conversion from 'QDir' to 'const QString'

                  Thanks for your help, I continue to work on your last comment.

                  J Offline
                  J Offline
                  JKSH
                  Moderators
                  wrote on 17 Mar 2022, 09:13 last edited by
                  #11

                  @UvQtcYZJuD7J5VW7 said in Dependencies missing after DLL compilation:

                  I prefer to use QWebSocket because on WebSocket connection, I serialize my data. My serializer doesn't work with LabView, it works with C++ Class, so for the next feature, it's better according to me to use QWebSocket.

                  I think it's easier to serialize your data in C++, pass the serialized byte array to LabVIEW, then write to a WebSocket in LabVIEW.

                  The stuff that I mentioned in my previous post (running an event loop in a background thread) is quite complex.

                  Obviously, I really need to familiarize myself with Qt ! But Qt Creator return me this error (in editor mode) : no viable conversion from 'QDir' to 'const QString'

                  QDir is not a QString, so you can't pass QDir to a function that expects a QString. You need to convert your QDir data to a QString first (see https://doc.qt.io/qt-5/qdir.html for your options)

                  Here is my error screen from LabView :

                  You should have gotten a more detailed error message when you first selected the DLL in the configuration dialog.

                  Delete the node, then re-create it. Pay attention to all messages that appear.

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  U 1 Reply Last reply 17 Mar 2022, 09:32
                  0
                  • J JKSH
                    17 Mar 2022, 09:13

                    @UvQtcYZJuD7J5VW7 said in Dependencies missing after DLL compilation:

                    I prefer to use QWebSocket because on WebSocket connection, I serialize my data. My serializer doesn't work with LabView, it works with C++ Class, so for the next feature, it's better according to me to use QWebSocket.

                    I think it's easier to serialize your data in C++, pass the serialized byte array to LabVIEW, then write to a WebSocket in LabVIEW.

                    The stuff that I mentioned in my previous post (running an event loop in a background thread) is quite complex.

                    Obviously, I really need to familiarize myself with Qt ! But Qt Creator return me this error (in editor mode) : no viable conversion from 'QDir' to 'const QString'

                    QDir is not a QString, so you can't pass QDir to a function that expects a QString. You need to convert your QDir data to a QString first (see https://doc.qt.io/qt-5/qdir.html for your options)

                    Here is my error screen from LabView :

                    You should have gotten a more detailed error message when you first selected the DLL in the configuration dialog.

                    Delete the node, then re-create it. Pay attention to all messages that appear.

                    U Offline
                    U Offline
                    UvQtcYZJuD7J5VW7
                    wrote on 17 Mar 2022, 09:32 last edited by UvQtcYZJuD7J5VW7
                    #12

                    @JKSH said in Dependencies missing after DLL compilation:

                    I think it's easier to serialize your data in C++, pass the serialized byte array to LabVIEW, then write to a WebSocket in LabVIEW.

                    Yes, I would also like to be able to do this but I use Protocol Buffers, I don't see how I could provide the classes generated by my serializer. I had thought of putting generated class by protobuf into a DLL and make the connection in the DLL. Labview just call DLL function (like connect, emit, disconnect...).
                    Otherwise I could programming the entire program in Qt and so I will not have the need to use a DLL.

                    You should have gotten a more detailed error message when you first selected the DLL in the configuration dialog.

                    Unfortunately, LabView is not very talkative. This is the only error message I get. I have already recreated the node.

                    J 1 Reply Last reply 18 Mar 2022, 15:41
                    0
                    • U UvQtcYZJuD7J5VW7
                      17 Mar 2022, 09:32

                      @JKSH said in Dependencies missing after DLL compilation:

                      I think it's easier to serialize your data in C++, pass the serialized byte array to LabVIEW, then write to a WebSocket in LabVIEW.

                      Yes, I would also like to be able to do this but I use Protocol Buffers, I don't see how I could provide the classes generated by my serializer. I had thought of putting generated class by protobuf into a DLL and make the connection in the DLL. Labview just call DLL function (like connect, emit, disconnect...).
                      Otherwise I could programming the entire program in Qt and so I will not have the need to use a DLL.

                      You should have gotten a more detailed error message when you first selected the DLL in the configuration dialog.

                      Unfortunately, LabView is not very talkative. This is the only error message I get. I have already recreated the node.

                      J Offline
                      J Offline
                      JKSH
                      Moderators
                      wrote on 18 Mar 2022, 15:41 last edited by
                      #13

                      @UvQtcYZJuD7J5VW7 said in Dependencies missing after DLL compilation:

                      Unfortunately, LabView is not very talkative. This is the only error message I get. I have already recreated the node.

                      Ah, check the dependencies of the DLLs that you deployed. For example, libgcc_s_dw2-1.dll depends on other DLLs too.

                      Otherwise I could programming the entire program in Qt and so I will not have the need to use a DLL.

                      If you can do everything in 1 language, that makes life a lot easier.

                      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                      1 Reply Last reply
                      0

                      13/13

                      18 Mar 2022, 15:41

                      • Login

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