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 to include file .h from other projects?
Qt 6.11 is out! See what's new in the release blog

How to include file .h from other projects?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.5k Views 1 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.
  • S Offline
    S Offline
    saobien39
    wrote on last edited by
    #1

    Hi everyone, I did 3 dialog projects, now I will create project main window, I wonder how to include file .h from other projects (copy it, create new one ...)?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      poor_robert
      wrote on last edited by
      #2

      Hmm, move header and source file to the directory where You created Your new project. Then include it in new file with #include directive. After that type (assuming that You are using Linux and You have Qt installed) in command line (be sure that Your working directory is new project directory):

      @make clean@

      @qmake -project@

      @qmake@

      @make@

      @./newProjectBin@

      If this won't help, write some more details: what do You use to write Your Qt applications (QtCreator, some other IDE). Then we will help You :)

      1 Reply Last reply
      0
      • S Offline
        S Offline
        saobien39
        wrote on last edited by
        #3

        I understand your idea, First, I think that I must copy file .h and .cpp from old projects to new project. But that way only resolves problem if we code form purely while having a dialog project I used qt designer. I must copy its file .ui to new project, doesn't it?

        ps: I love Windows :)

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          bq. I must copy its file .ui to new project, doesn’t it?

          Yes, you should add it also in your pro file. eg. :

          FORMS    += yourdialog.ui

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • S Offline
            S Offline
            saobien39
            wrote on last edited by
            #5

            Thanks everyone!

            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