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 I link 2 project in creator?
Qt 6.11 is out! See what's new in the release blog

How I link 2 project in creator?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 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.
  • W Offline
    W Offline
    whynoitwork
    wrote on last edited by
    #1

    I want link 2 project together but how?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi, welcome to devnet.

      Assuming project one produces an executable and project two produces a library and you want to keep them in a single workspace then these are the steps:

      • Go to project tab and in the dependencies tab of project one select project two. This will assure proper build order.
      • Add this to the .pro file of project one:
        INCLUDEPATH += path/to/project2/headers/
        LIBS += -Lpath/to/lib2/ -lproject2
      • (Optional) Add this to .pro file of project one:
        PRE_TARGETDEPS += path/to/project2lib
        This ensures that if project two is changed it will built before linking to project one.
      1 Reply Last reply
      0
      • W Offline
        W Offline
        whynoitwork
        wrote on last edited by
        #3

        I try that and ok it works but I get LNK2019 when trying to reference code from other project.

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You're gonna have to be more specific than that. This is an unresolved external error, but what symbol doesn't get resolved? Is it from app one, two, Qt or 3rd party lib? Is the symbol a function, an object, an extern?

          Did you re-run qmake after making these changes in the .pro file?

          1 Reply Last reply
          0
          • W Offline
            W Offline
            whynoitwork
            wrote on last edited by
            #5

            Yes it is unresolved for a class in the project 2.

            I link by the gui and still it get the link error.

            I rerun qmake, clean, etc no difference.

            I will try a bare bones tomorrow with 2 basic projects 1 class each only and try to link projects.

            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