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. Can not create/use DLL
Qt 6.11 is out! See what's new in the release blog

Can not create/use DLL

Scheduled Pinned Locked Moved Unsolved General and Desktop
28 Posts 4 Posters 2.7k Views 2 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.
  • J JacobNovitsky

    @SGaist side question too :)
    where can I read about QMAKE?

    SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #19

    In the qmake manual

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

    J 1 Reply Last reply
    1
    • SGaistS SGaist

      In the qmake manual

      J Offline
      J Offline
      JacobNovitsky
      wrote on last edited by
      #20

      Libtest.pro
      QT = core

      CONFIG += c++17 cmdline

      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

      LIBS +=/home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
      INCLUDEPATH +=/home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
      DEPENDPATH +=/home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
      PRE_TARGETDEPS +=/home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug

      MyLib.pro

      QT -= gui

      TEMPLATE = lib
      DEFINES += MYLIB_LIBRARY

      CONFIG += c++17

      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 +=
      mylib.cpp

      HEADERS +=
      MyLib_global.h
      mylib.h

      Default rules for deployment.

      unix {
      target.path = /usr/lib
      }
      !isEmpty(target.path): INSTALLS += target

      :-1: error: cannot find /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug: file format not recognized

      How to fix error above? There is still no DLL, if I comply with syntax, shall I get dll?

      jsulmJ 1 Reply Last reply
      0
      • J JacobNovitsky

        Libtest.pro
        QT = core

        CONFIG += c++17 cmdline

        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

        LIBS +=/home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
        INCLUDEPATH +=/home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
        DEPENDPATH +=/home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
        PRE_TARGETDEPS +=/home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug

        MyLib.pro

        QT -= gui

        TEMPLATE = lib
        DEFINES += MYLIB_LIBRARY

        CONFIG += c++17

        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 +=
        mylib.cpp

        HEADERS +=
        MyLib_global.h
        mylib.h

        Default rules for deployment.

        unix {
        target.path = /usr/lib
        }
        !isEmpty(target.path): INSTALLS += target

        :-1: error: cannot find /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug: file format not recognized

        How to fix error above? There is still no DLL, if I comply with syntax, shall I get dll?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #21

        @JacobNovitsky You should really read the link @SGaist gave you.
        In LIBS you need to also specify the lib you want to link.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        J 1 Reply Last reply
        0
        • jsulmJ jsulm

          @JacobNovitsky You should really read the link @SGaist gave you.
          In LIBS you need to also specify the lib you want to link.

          J Offline
          J Offline
          JacobNovitsky
          wrote on last edited by
          #22

          @jsulm if I use in the LIBS line something with prefix -lmylib it does not work :)
          what should I exactly insert to LIBS line?

          J 1 Reply Last reply
          0
          • J JacobNovitsky

            @jsulm if I use in the LIBS line something with prefix -lmylib it does not work :)
            what should I exactly insert to LIBS line?

            J Offline
            J Offline
            JacobNovitsky
            wrote on last edited by JacobNovitsky
            #23

            changed to

                LIBS += -L/home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug -lMyLib
                INCLUDEPATH += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
                DEPENDPATH += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
                PRE_TARGETDEPS += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
            

            it builds, but how to gett .dll file?

            J SGaistS 2 Replies Last reply
            0
            • J JacobNovitsky

              changed to

                  LIBS += -L/home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug -lMyLib
                  INCLUDEPATH += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
                  DEPENDPATH += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
                  PRE_TARGETDEPS += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
              

              it builds, but how to gett .dll file?

              J Offline
              J Offline
              JacobNovitsky
              wrote on last edited by JacobNovitsky
              #24

              If I just link header which includes other project headers, it means my program auto include all headers which increase building and execution time?
              same going to happen if I use dll, I'm I correct?

              SGaistS 1 Reply Last reply
              0
              • J JacobNovitsky

                changed to

                    LIBS += -L/home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug -lMyLib
                    INCLUDEPATH += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
                    DEPENDPATH += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
                    PRE_TARGETDEPS += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
                

                it builds, but how to gett .dll file?

                SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #25

                @JacobNovitsky said in Can not create/use DLL:

                changed to

                    LIBS += -L/home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug -lMyLib
                    INCLUDEPATH += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
                    DEPENDPATH += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
                    PRE_TARGETDEPS += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
                

                it builds, but how to gett .dll file?

                If after building, you don't have any dll then it means you are not exporting anything from your code.

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

                J 1 Reply Last reply
                0
                • J JacobNovitsky

                  If I just link header which includes other project headers, it means my program auto include all headers which increase building and execution time?
                  same going to happen if I use dll, I'm I correct?

                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by SGaist
                  #26

                  @JacobNovitsky said in Can not create/use DLL:

                  If I just link header which includes other project headers, it means my program auto include all headers which increase building and execution time?
                  same going to happen if I use dll, I'm I correct?

                  Build time, yes hence only include what you use in your headers and for the rest use forward declarations. As for execution time, no, it's not directly related.

                  What do you mean by "if I use dll".

                  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
                  • SGaistS SGaist

                    @JacobNovitsky said in Can not create/use DLL:

                    changed to

                        LIBS += -L/home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug -lMyLib
                        INCLUDEPATH += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
                        DEPENDPATH += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
                        PRE_TARGETDEPS += /home/supernova/build-MyLib-Desktop_Qt_6_2_4_GCC_64bit-Debug
                    

                    it builds, but how to gett .dll file?

                    If after building, you don't have any dll then it means you are not exporting anything from your code.

                    J Offline
                    J Offline
                    JacobNovitsky
                    wrote on last edited by
                    #27

                    @SGaist It feels like I'm close to solve this, what am I missing? What I need to do in order to get dll?

                    SGaistS 1 Reply Last reply
                    0
                    • J JacobNovitsky

                      @SGaist It feels like I'm close to solve this, what am I missing? What I need to do in order to get dll?

                      SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #28

                      @JacobNovitsky as I wrote: check that you are properly exporting stuff from your library code.

                      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