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

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.
  • S Offline
    S Offline
    SergioDanielG
    wrote on 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 last edited by
      #3

      Yes, I did...

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ArchGabe
        wrote on last edited by
        #4

        test.hpp: no such file or directory

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SergioDanielG
          wrote on 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 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
            • francescmmF Offline
              francescmmF Offline
              francescmm
              wrote on 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 last edited by
                #8

                Now I am getting multiple definition error...

                1 Reply Last reply
                0
                • francescmmF Offline
                  francescmmF Offline
                  francescmm
                  wrote on 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 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
                    • francescmmF Offline
                      francescmmF Offline
                      francescmm
                      wrote on 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 last edited by
                        #12

                        No...

                        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