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. Calling external functions from QT
Forum Update on Monday, May 27th 2025

Calling external functions from QT

Scheduled Pinned Locked Moved General and Desktop
12 Posts 3 Posters 2.6k 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.
  • A Offline
    A Offline
    ArchGabe
    wrote on 3 Jul 2013, 14:52 last edited by
    #1

    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
    0
    • S Offline
      S Offline
      SergioDanielG
      wrote on 3 Jul 2013, 15:03 last edited by
      #2

      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
      0
      • A Offline
        A Offline
        ArchGabe
        wrote on 3 Jul 2013, 15:04 last edited by
        #3

        Yes, I did...

        1 Reply Last reply
        0
        • A Offline
          A Offline
          ArchGabe
          wrote on 3 Jul 2013, 15:07 last edited by
          #4

          test.hpp: no such file or directory

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SergioDanielG
            wrote on 3 Jul 2013, 15:09 last edited by
            #5

            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
            0
            • A Offline
              A Offline
              ArchGabe
              wrote on 3 Jul 2013, 15:28 last edited by
              #6

              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
              0
              • F Offline
                F Offline
                francescmm
                wrote on 3 Jul 2013, 15:38 last edited by
                #7

                You should use:

                • INCLUDEPAT += path/to/include

                In the .pro file.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  ArchGabe
                  wrote on 3 Jul 2013, 15:50 last edited by
                  #8

                  Now I am getting multiple definition error...

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    francescmm
                    wrote on 3 Jul 2013, 15:52 last edited by
                    #9

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

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      ArchGabe
                      wrote on 3 Jul 2013, 15:57 last edited by
                      #10

                      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
                      0
                      • F Offline
                        F Offline
                        francescmm
                        wrote on 3 Jul 2013, 16:19 last edited by
                        #11

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

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          ArchGabe
                          wrote on 3 Jul 2013, 16:33 last edited by
                          #12

                          No...

                          1 Reply Last reply
                          0

                          1/12

                          3 Jul 2013, 14:52

                          • Login

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