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. Cannot recognize header .h file from external dynamic library
Forum Updated to NodeBB v4.3 + New Features

Cannot recognize header .h file from external dynamic library

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 3 Posters 1.4k 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.
  • JoeCFDJ JoeCFD

    @ItzMeJP said in Cannot recognize header .h file from external dynamic library:

    INCLUDE_FOLDER

    From INCLUDEPATH += $$PWD/libs, it can be assumed that the header files are in $$PWD/libs.
    I guess you may do this
    #include "mimic_grasping_server.h"

    I Offline
    I Offline
    ItzMeJP
    wrote on last edited by
    #7

    @JoeCFD said in Cannot recognize header .h file from external dynamic library:

    @ItzMeJP said in Cannot recognize header .h file from external dynamic library:

    INCLUDE_FOLDER

    From INCLUDEPATH += $$PWD/libs, it can be assumed that the header files are in $$PWD/libs.
    I guess you may do this
    #include "mimic_grasping_server.h"

    @JoeCFD I already try this one, even though #include "mimic_grasping_server/mimic_grasping_server.h". None of these worked.

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

      At the risk of repeating myself: where is that header file located on your hard drive exactly ?

      From your mimic_grasping_gui project structure, it does not seem to be in there, correct ?

      If so, where exactly is it ? Depending on that answer, you'll have to adjust the INCLUDEPATH variable content.

      By the way, why are you putting the library itself in your project sources ?

      On an unrelated note, since you are already using cmake for your library, why not also for your GUI project ?

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

      I 1 Reply Last reply
      0
      • I ItzMeJP

        @JoeCFD said in Cannot recognize header .h file from external dynamic library:

        @ItzMeJP said in Cannot recognize header .h file from external dynamic library:

        INCLUDE_FOLDER

        From INCLUDEPATH += $$PWD/libs, it can be assumed that the header files are in $$PWD/libs.
        I guess you may do this
        #include "mimic_grasping_server.h"

        @JoeCFD I already try this one, even though #include "mimic_grasping_server/mimic_grasping_server.h". None of these worked.

        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #9

        @ItzMeJP List your Makefile here generated with .pro.

        I 1 Reply Last reply
        0
        • JoeCFDJ JoeCFD

          @ItzMeJP List your Makefile here generated with .pro.

          I Offline
          I Offline
          ItzMeJP
          wrote on last edited by
          #10

          @JoeCFD said in Cannot recognize header .h file from external dynamic library:

          @ItzMeJP List your Makefile here generated with .pro.

          Sorry I cannot upload the file here (not even attach the file). I do not have enough reputation and privileges. Thus I shared through this link:

          https://drive.google.com/file/d/1VptBnHB0d_YPnofJUKMHfAWquP60sQBj/view?usp=sharing

          1 Reply Last reply
          0
          • SGaistS SGaist

            At the risk of repeating myself: where is that header file located on your hard drive exactly ?

            From your mimic_grasping_gui project structure, it does not seem to be in there, correct ?

            If so, where exactly is it ? Depending on that answer, you'll have to adjust the INCLUDEPATH variable content.

            By the way, why are you putting the library itself in your project sources ?

            On an unrelated note, since you are already using cmake for your library, why not also for your GUI project ?

            I Offline
            I Offline
            ItzMeJP
            wrote on last edited by ItzMeJP
            #11

            @SGaist said in Cannot recognize header .h file from external dynamic library:

            At the risk of repeating myself: where is that header file located on your hard drive exactly ?

            There are no ".h". It is a dynamic lib import. Look at the case of Boost Thread lib. I added that as " unix|win32: LIBS += -lboost_thread " and the main code can recognize its include as "#include <boost/thread.hpp>"

            From your mimic_grasping_gui project structure, it does not seem to be in there, correct ?

            This is a folder to place all external APIs. Thus, when changing PC, I know exactly all .so prerequisites.

            By the way, why are you putting the library itself in your project sources ?
            On an unrelated note, since you are already using cmake for your library, why not also for your GUI project ?

            I don't want to. My API is used in different systems and is programmed in pure C++. The GUI is just one of them.

            JoeCFDJ 1 Reply Last reply
            0
            • I ItzMeJP

              @SGaist said in Cannot recognize header .h file from external dynamic library:

              At the risk of repeating myself: where is that header file located on your hard drive exactly ?

              There are no ".h". It is a dynamic lib import. Look at the case of Boost Thread lib. I added that as " unix|win32: LIBS += -lboost_thread " and the main code can recognize its include as "#include <boost/thread.hpp>"

              From your mimic_grasping_gui project structure, it does not seem to be in there, correct ?

              This is a folder to place all external APIs. Thus, when changing PC, I know exactly all .so prerequisites.

              By the way, why are you putting the library itself in your project sources ?
              On an unrelated note, since you are already using cmake for your library, why not also for your GUI project ?

              I don't want to. My API is used in different systems and is programmed in pure C++. The GUI is just one of them.

              JoeCFDJ Offline
              JoeCFDJ Offline
              JoeCFD
              wrote on last edited by JoeCFD
              #12

              @ItzMeJP
              You are using relative path for include path.
              INCPATH = -I../mimic_grasping_3 -I. -I../mimic_grasping_3/libs -I../../Qt/5.15.2/gcc_64/include

              Your lib path is not. You make them consistent. You will be all right. Could be your PWD setting is not right.
              LIBS = $(SUBLIBS) -lboost_thread -L/home/joaopedro/qt_ws/mimic_grasping_3/libs/ -lmimic_grasping_server /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt53DExtras.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt53DRender.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt53DInput.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt53DLogic.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt53DCore.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt5Gamepad.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt5Widgets.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt5Gui.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt5Network.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt5Core.so -lGL -lpthread

              I 1 Reply Last reply
              0
              • JoeCFDJ Offline
                JoeCFDJ Offline
                JoeCFD
                wrote on last edited by
                #13

                INCLUDEPATH += $$absolute_path($$PWD)/libs
                DEPENDPATH += $$absolute_path($$PWD)/libs

                check your Makefile to see if it helps.

                I 1 Reply Last reply
                0
                • JoeCFDJ JoeCFD

                  @ItzMeJP
                  You are using relative path for include path.
                  INCPATH = -I../mimic_grasping_3 -I. -I../mimic_grasping_3/libs -I../../Qt/5.15.2/gcc_64/include

                  Your lib path is not. You make them consistent. You will be all right. Could be your PWD setting is not right.
                  LIBS = $(SUBLIBS) -lboost_thread -L/home/joaopedro/qt_ws/mimic_grasping_3/libs/ -lmimic_grasping_server /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt53DExtras.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt53DRender.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt53DInput.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt53DLogic.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt53DCore.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt5Gamepad.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt5Widgets.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt5Gui.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt5Network.so /home/joaopedro/Qt/5.15.2/gcc_64/lib/libQt5Core.so -lGL -lpthread

                  I Offline
                  I Offline
                  ItzMeJP
                  wrote on last edited by
                  #14
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #15

                    You had it working with boost because it has likely been installed using your system's package manager and if not, it's located in one of the default paths looked for by the compiler.

                    There's not automagical header include path discovery when you only provide the library.

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

                    I 1 Reply Last reply
                    1
                    • JoeCFDJ JoeCFD

                      INCLUDEPATH += $$absolute_path($$PWD)/libs
                      DEPENDPATH += $$absolute_path($$PWD)/libs

                      check your Makefile to see if it helps.

                      I Offline
                      I Offline
                      ItzMeJP
                      wrote on last edited by
                      #16

                      @JoeCFD No, it does not help. The MakeFile still the same...

                      1 Reply Last reply
                      0
                      • SGaistS SGaist

                        You had it working with boost because it has likely been installed using your system's package manager and if not, it's located in one of the default paths looked for by the compiler.

                        There's not automagical header include path discovery when you only provide the library.

                        I Offline
                        I Offline
                        ItzMeJP
                        wrote on last edited by
                        #17

                        @SGaist said in Cannot recognize header .h file from external dynamic library:

                        You had it working with boost because it has likely been installed using your system's package manager and if not, it's located in one of the default paths looked for by the compiler.

                        There's not automagical header include path discovery when you only provide the library.

                        Thus, what is the recommended procedure to generate the dynamic lib and import it to Qt?

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

                          There's nothing special.

                          Every library has a set of one or more headers they provide along the library file itself.

                          There are standard locations to put them and if yours is not in one of them then you simply have to add the path to them to INCLUDEPATH.

                          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
                          1
                          • JoeCFDJ Offline
                            JoeCFDJ Offline
                            JoeCFD
                            wrote on last edited by
                            #19

                            replace -I../mimic_grasping_3/libs of INCPATH in Makefile with -I/home/joaopedro/qt_ws/mimic_grasping_3/libs manually. Save it and then run make to see if it works.
                            if not, run
                            locate mimic_grasping_server.h
                            to see where the file is located.

                            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