Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Adding a QtCreator Library to a Project
Qt 6.12 LTS is out! See what's new in the release blog

Adding a QtCreator Library to a Project

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
3 Posts 2 Posters 845 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.
  • O Offline
    O Offline
    ofmrew
    wrote on last edited by
    #1

    I Opened QtCreator, selected New Project and then Library, a C++ library. Now I want to add it to another Project: I am tired of using add new for both headers and sources for all the classes. I have that Library, but I cannot find a way to add it to another project--I was succssful in the past, but I forgot how I did it. I tried all the steps in the documentation to no avail. I did build the .pro file and it worked; however, I promoted Widget to one of the classes in the library. When I compiled I get an UI error that it cannot find the .h file of the promoted class. It seems to require the full path. I believe that I found the problem in the XML file generated by the designer, but the XML file is read only.

    Does anyone know how to add a QtCreator Library, it is a directory, not as file; it contains the .h and .cpp files and a .pro file?

    O 1 Reply Last reply
    0
    • O ofmrew

      I Opened QtCreator, selected New Project and then Library, a C++ library. Now I want to add it to another Project: I am tired of using add new for both headers and sources for all the classes. I have that Library, but I cannot find a way to add it to another project--I was succssful in the past, but I forgot how I did it. I tried all the steps in the documentation to no avail. I did build the .pro file and it worked; however, I promoted Widget to one of the classes in the library. When I compiled I get an UI error that it cannot find the .h file of the promoted class. It seems to require the full path. I believe that I found the problem in the XML file generated by the designer, but the XML file is read only.

      Does anyone know how to add a QtCreator Library, it is a directory, not as file; it contains the .h and .cpp files and a .pro file?

      O Offline
      O Offline
      ofmrew
      wrote on last edited by
      #2

      @ofmrew A followup: I deleted the class from the Library and created it the normal way. It seems to work, but I would like to do it the correct way and not built the .pro file for each project.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        I have a subdir project with its .pro file. I build new subproject and add it to my project.
        Then I change the new subproject .pro to "TEMPLATE = lib" and rebuild the entire project.
        Then I add the new (internal) library using "add library " to my main .pro or to whatever subproject needs it. .
        Little convoluted but reliable and repeatable.
        ( I am using Linux, if it makes a difference )

        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
        • Unsolved