Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Calling external functions from QT

    General and Desktop
    3
    12
    2148
    Loading More Posts
    • 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.
    • A
      ArchGabe last edited by

      Hi guys,

      I developed a whole new library to do some calculations on Eclipse. Now I need to call these functions inside Qt. I added the path to PATH variable at .pro file, but when I try to compile, I get "no such file or directory" error. Any idea on how to solve this?

      1 Reply Last reply Reply Quote 0
      • S
        SergioDanielG last edited by

        Hi ArchGabe.
        Did you add LIBS += "/path/to/lib" to .pro file?
        Regards.

        www.ftatv.com.ar El foro argentino de la TV libre

        1 Reply Last reply Reply Quote 0
        • A
          ArchGabe last edited by

          Yes, I did...

          1 Reply Last reply Reply Quote 0
          • A
            ArchGabe last edited by

            test.hpp: no such file or directory

            1 Reply Last reply Reply Quote 0
            • S
              SergioDanielG last edited by

              Well, to do this, I'm doing..

              1. Add LIBS += to .pro file.
              2. Add .h of library to my project.
              3. Copy library to app folder.

              Hope it's util.

              Regards.

              www.ftatv.com.ar El foro argentino de la TV libre

              1 Reply Last reply Reply Quote 0
              • A
                ArchGabe last edited by

                Actually, there is no .lib file. All I want is to import the header file, which has all the functions definitions...

                1 Reply Last reply Reply Quote 0
                • francescmm
                  francescmm last edited by

                  You should use:

                  • INCLUDEPAT += path/to/include

                  In the .pro file.

                  1 Reply Last reply Reply Quote 0
                  • A
                    ArchGabe last edited by

                    Now I am getting multiple definition error...

                    1 Reply Last reply Reply Quote 0
                    • francescmm
                      francescmm last edited by

                      You should include all the includes necessaries. More information would be confortable...

                      1 Reply Last reply Reply Quote 0
                      • A
                        ArchGabe last edited by

                        I did...
                        .
                        On Eclipse, I created a .hpp file like this:

                        @
                        #ifndef FUNCTION__HPP__
                        #define FUNCTION__HPP__

                        int foo() {return 2;}

                        #endif
                        @

                        Then, I added the following path to my QT project .pro file:

                        @
                        INCLUDEPATH += /path_to_hpp_file
                        @

                        My mainwindow.h

                        @
                        #include "function.hpp"
                        @

                        and on my mainwindow.cpp also (wich doensn't change anything):

                        @
                        #include "function.hpp"
                        @

                        Now I am getting "multiple definition" error... And I don't know why...

                        1 Reply Last reply Reply Quote 0
                        • francescmm
                          francescmm last edited by

                          It's the method already defined in other part of your code?

                          1 Reply Last reply Reply Quote 0
                          • A
                            ArchGabe last edited by

                            No...

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post