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. How to set the location to load library files
QtWS25 Last Chance

How to set the location to load library files

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 3 Posters 477 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.
  • I Offline
    I Offline
    IknowQT
    wrote on last edited by
    #1
    ###################### MainWidget ######################
    # ----------------------------------------------------
    # This file is generated by the Qt Visual Studio Tools.
    # ------------------------------------------------------
    
    QT       += core gui widgets
    
    CONFIG += c++11
    
    TEMPLATE = app
    TARGET = MainWidget
    
    MOC_DIR += .
    OBJECTS_DIR += debug
    UI_DIR += .
    RCC_DIR += .
    include(MainWidget.pri)
    
    # �쇱�踰�由ы����Depoly
    unix {
            target.path = /home/pi/QT_Execfiles
            INSTALLS += target
    }
    
    # �ㅽ������������移�
    CONFIG(debug, debug|release) {
        DESTDIR = $$PWD/../Depoly_Exec/debug
    } else {
        DESTDIR = $$PWD/../Depoly_Exec/release
    }
    
    #win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../Depoly_Exec/release/ -lCustomIndicator
    #else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../Depoly_Exec/debug/ -lCustomIndicator
    #else:unix:!macx: LIBS += -L$$PWD/../Depoly_Exec/ -lCustomIndicator
    
    LIBS += -L$$PWD/../Depoly_Exec/debug/ -lCustomIndicator
    
    INCLUDEPATH += $$PWD/../Depoly_Exec/debug
    DEPENDPATH += $$PWD/../Depoly_Exec/debug
    
    ###################### CustomIndicator ######################
    # ----------------------------------------------------
    # This file is generated by the Qt Visual Studio Tools.
    # ------------------------------------------------------
    
    QT += gui core widgets
    TEMPLATE = lib
    DEFINES += CUSTOMINDICATOR_LIB
    TARGET = CustomIndicator
    CONFIG += c++11
    
    SOURCES += ./CustomIndicator.cpp
    HEADERS += ./customindicator_global.h \
        ./CustomIndicator.h
    
    # �ㅽ������������移�
    CONFIG(debug, debug|release) {
        DESTDIR = $$PWD/../Depoly_Exec/debug
    } 
    else {
        DESTDIR = $$PWD/../Depoly_Exec/release
    }
    

    I want to create a dll file normally and load the file in MainWidget
    Can you see if the way I did it is right?
    When I try to declare CustomIndicator in the include header, it says the file cannot be found.

    In the Depoly_Exec folder, I could confirm that the dll file and lib file were created normally.

    jsulmJ 1 Reply Last reply
    0
    • I IknowQT
      ###################### MainWidget ######################
      # ----------------------------------------------------
      # This file is generated by the Qt Visual Studio Tools.
      # ------------------------------------------------------
      
      QT       += core gui widgets
      
      CONFIG += c++11
      
      TEMPLATE = app
      TARGET = MainWidget
      
      MOC_DIR += .
      OBJECTS_DIR += debug
      UI_DIR += .
      RCC_DIR += .
      include(MainWidget.pri)
      
      # �쇱�踰�由ы����Depoly
      unix {
              target.path = /home/pi/QT_Execfiles
              INSTALLS += target
      }
      
      # �ㅽ������������移�
      CONFIG(debug, debug|release) {
          DESTDIR = $$PWD/../Depoly_Exec/debug
      } else {
          DESTDIR = $$PWD/../Depoly_Exec/release
      }
      
      #win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../Depoly_Exec/release/ -lCustomIndicator
      #else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../Depoly_Exec/debug/ -lCustomIndicator
      #else:unix:!macx: LIBS += -L$$PWD/../Depoly_Exec/ -lCustomIndicator
      
      LIBS += -L$$PWD/../Depoly_Exec/debug/ -lCustomIndicator
      
      INCLUDEPATH += $$PWD/../Depoly_Exec/debug
      DEPENDPATH += $$PWD/../Depoly_Exec/debug
      
      ###################### CustomIndicator ######################
      # ----------------------------------------------------
      # This file is generated by the Qt Visual Studio Tools.
      # ------------------------------------------------------
      
      QT += gui core widgets
      TEMPLATE = lib
      DEFINES += CUSTOMINDICATOR_LIB
      TARGET = CustomIndicator
      CONFIG += c++11
      
      SOURCES += ./CustomIndicator.cpp
      HEADERS += ./customindicator_global.h \
          ./CustomIndicator.h
      
      # �ㅽ������������移�
      CONFIG(debug, debug|release) {
          DESTDIR = $$PWD/../Depoly_Exec/debug
      } 
      else {
          DESTDIR = $$PWD/../Depoly_Exec/release
      }
      

      I want to create a dll file normally and load the file in MainWidget
      Can you see if the way I did it is right?
      When I try to declare CustomIndicator in the include header, it says the file cannot be found.

      In the Depoly_Exec folder, I could confirm that the dll file and lib file were created normally.

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

      @IknowQT said in How to set the location to load library files:

      LIBS += -L$$PWD/../Depoly_Exec/debug/ -lCustomIndicator

      INCLUDEPATH += $$PWD/../Depoly_Exec/debug
      DEPENDPATH += $$PWD/../Depoly_Exec/debug

      You want to search for header files in deployment folder?

      The proper way to manage this is to use https://wiki.qt.io/SUBDIRS_-_handling_dependencies

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

      I 1 Reply Last reply
      0
      • jsulmJ jsulm

        @IknowQT said in How to set the location to load library files:

        LIBS += -L$$PWD/../Depoly_Exec/debug/ -lCustomIndicator

        INCLUDEPATH += $$PWD/../Depoly_Exec/debug
        DEPENDPATH += $$PWD/../Depoly_Exec/debug

        You want to search for header files in deployment folder?

        The proper way to manage this is to use https://wiki.qt.io/SUBDIRS_-_handling_dependencies

        I Offline
        I Offline
        IknowQT
        wrote on last edited by IknowQT
        #3

        @jsulm

        What's the reason you can't load it?

        TEMPLATE = subdirs
        SUBDIRS += MainWidget/MainWidget.pro \
            CustomIndicator/CustomIndicator.pro
        
        
        jsulmJ 1 Reply Last reply
        0
        • I IknowQT

          @jsulm

          What's the reason you can't load it?

          TEMPLATE = subdirs
          SUBDIRS += MainWidget/MainWidget.pro \
              CustomIndicator/CustomIndicator.pro
          
          
          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @IknowQT said in How to set the location to load library files:

          What's the reason you can't load it?

          Load what?
          Please ask understandable questions.

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

          I 1 Reply Last reply
          0
          • jsulmJ jsulm

            @IknowQT said in How to set the location to load library files:

            What's the reason you can't load it?

            Load what?
            Please ask understandable questions.

            I Offline
            I Offline
            IknowQT
            wrote on last edited by
            #5

            @jsulm

            I wonder why the header file can't be found.
            It doesn't seem to be a problem with the path.

            00ef0351-ab5c-4631-8490-ae086ce3453f-image.png
            69314b2e-bb73-472d-920a-4da6f2d44bdb-image.png

            JonBJ jsulmJ 2 Replies Last reply
            0
            • I IknowQT

              @jsulm

              I wonder why the header file can't be found.
              It doesn't seem to be a problem with the path.

              00ef0351-ab5c-4631-8490-ae086ce3453f-image.png
              69314b2e-bb73-472d-920a-4da6f2d44bdb-image.png

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @IknowQT
              There is no .h file in the directory you show, and it's not where header files are sought anyway. Where is your CustomIndicator.h file, and how does it relate your INCLUDEPATH?

              I 1 Reply Last reply
              0
              • I IknowQT

                @jsulm

                I wonder why the header file can't be found.
                It doesn't seem to be a problem with the path.

                00ef0351-ab5c-4631-8490-ae086ce3453f-image.png
                69314b2e-bb73-472d-920a-4da6f2d44bdb-image.png

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

                @IknowQT You simply need to specify your project dependencies.
                Your MainWidget depends on CustomIndicator.
                In the link a gave you is one example (last line):

                TEMPLATE = subdirs
                 
                  SUBDIRS = \
                            lib2 \   # sub-project names
                            lib  \
                            app
                 
                  # where to find the sub projects - give the folders
                  lib2.subdir = src/lib2
                  lib.subdir  = src/lib
                  app.subdir  = src/app
                 
                  # what subproject depends on others
                  app.depends = lib lib2
                

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

                I 1 Reply Last reply
                2
                • jsulmJ jsulm

                  @IknowQT You simply need to specify your project dependencies.
                  Your MainWidget depends on CustomIndicator.
                  In the link a gave you is one example (last line):

                  TEMPLATE = subdirs
                   
                    SUBDIRS = \
                              lib2 \   # sub-project names
                              lib  \
                              app
                   
                    # where to find the sub projects - give the folders
                    lib2.subdir = src/lib2
                    lib.subdir  = src/lib
                    app.subdir  = src/app
                   
                    # what subproject depends on others
                    app.depends = lib lib2
                  
                  I Offline
                  I Offline
                  IknowQT
                  wrote on last edited by
                  #8

                  @jsulm

                  ############ main.pro file ############
                  # ----------------------------------------------------
                  # This file is generated by the Qt Visual Studio Tools.
                  # ------------------------------------------------------
                  
                  # This is a reminder that you are using a generated .pro file.
                  # Remove it when you are finished editing this file.
                  message("You are running qmake on a generated .pro file. This may not work!")
                  
                  
                  TEMPLATE = subdirs
                  SUBDIRS += MainWidget/MainWidget.pro \
                      CustomIndicator/CustomIndicator.pro
                  

                  Am I doing it right as you suggested?

                  jsulmJ 1 Reply Last reply
                  0
                  • JonBJ JonB

                    @IknowQT
                    There is no .h file in the directory you show, and it's not where header files are sought anyway. Where is your CustomIndicator.h file, and how does it relate your INCLUDEPATH?

                    I Offline
                    I Offline
                    IknowQT
                    wrote on last edited by
                    #9

                    @JonB

                    I made it as a dll file and there seems to be a problem in the process of including the dll file.

                    1 Reply Last reply
                    0
                    • I IknowQT

                      @jsulm

                      ############ main.pro file ############
                      # ----------------------------------------------------
                      # This file is generated by the Qt Visual Studio Tools.
                      # ------------------------------------------------------
                      
                      # This is a reminder that you are using a generated .pro file.
                      # Remove it when you are finished editing this file.
                      message("You are running qmake on a generated .pro file. This may not work!")
                      
                      
                      TEMPLATE = subdirs
                      SUBDIRS += MainWidget/MainWidget.pro \
                          CustomIndicator/CustomIndicator.pro
                      

                      Am I doing it right as you suggested?

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

                      @IknowQT said in How to set the location to load library files:

                      Am I doing it right as you suggested?

                      No.
                      Please read more carefully!
                      You specify the subfolders in SUBDIRS, not pro files.
                      And you did not specify the dependencies like shown in the example. Why?

                      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