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 can I quickly import files from another project??
Qt 6.11 is out! See what's new in the release blog

How can I quickly import files from another project??

Scheduled Pinned Locked Moved General and Desktop
18 Posts 2 Posters 3.3k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #4

    Then, the second question: do you want to rebuild these files in your new project ?

    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
    0
    • U Offline
      U Offline
      User0
      wrote on last edited by
      #5

      Oh, I'm sorry. Yes I want.

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

        Then the quick and dirty way to do this is:

        SOURCES += /path/to/your/other/project/cpp_file.cpp
        INCLUDES += /path/to/your/other/project/header_file.h
        

        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
        0
        • U Offline
          U Offline
          User0
          wrote on last edited by
          #7

          Already tried, but it was occurred an issue:

          :-1: error: No rule to make target ../Library/Lib/mathfuncslib.cpp', needed by mathfuncslib.o'. Stop.

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

            Can you show your pro file ?

            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
            0
            • U Offline
              U Offline
              User0
              wrote on last edited by
              #9
              This post is deleted!
              1 Reply Last reply
              0
              • U Offline
                U Offline
                User0
                wrote on last edited by
                #10

                I'm sorry:

                QT = core gui

                greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                SOURCES += ~/Library/Lib/mathfuncslib.cpp
                INCLUDES += ~/Library/Lib/mathfuncslib.h
                SOURCES +=
                main.cpp

                But I get the same result..

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

                  I'd rather go with an absolute path

                  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
                  0
                  • U Offline
                    U Offline
                    User0
                    wrote on last edited by
                    #12

                    Unfortunately it's the same.

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

                      Which version of Qt are you using ?

                      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
                      0
                      • U Offline
                        U Offline
                        User0
                        wrote on last edited by
                        #14

                        5.4 version

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

                          Did you re-run qmake ?

                          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
                          0
                          • U Offline
                            U Offline
                            User0
                            wrote on last edited by
                            #16

                            Yes I did!!

                            1 Reply Last reply
                            0
                            • U Offline
                              U Offline
                              User0
                              wrote on last edited by
                              #17

                              Ok! The path was wrong!
                              Now, I have to include the file in the main also? If yes, I have to use the absolute path?

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

                                You can use them as normal. You need to update INCLUDEPATH to also contain the folder where the headers are located.

                                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
                                0

                                • Login

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