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 create both a library and app from .pro file?
Forum Update on Monday, May 27th 2025

How to create both a library and app from .pro file?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 318 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.
  • HunterMetcalfeH Offline
    HunterMetcalfeH Offline
    HunterMetcalfe
    wrote on last edited by
    #1

    The title says it all! I'm not necessarily the best when it comes to pro files. I know how to create an executable and a library but not together in the same Makefile. I'd like to see something like libmyapp.a and then myapp (executable) after my application builds. Further, how does one create both a debug and release executable?

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

      Hi and welcome to devnet,

      The simplest and cleanest is to use the SUBDIRS template.

      You'll have then two different projects. One for handling your library and one for your application.

      As for your last question: you build it twice. Once for each mode.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      HunterMetcalfeH 1 Reply Last reply
      2
      • SGaistS SGaist

        Hi and welcome to devnet,

        The simplest and cleanest is to use the SUBDIRS template.

        You'll have then two different projects. One for handling your library and one for your application.

        As for your last question: you build it twice. Once for each mode.

        HunterMetcalfeH Offline
        HunterMetcalfeH Offline
        HunterMetcalfe
        wrote on last edited by
        #3

        @SGaist Thanks! I did just that. Moved all of my files into a library directory and only a main into an app directory with their own individual .pro files and it worked. I appreciate it.

        1 Reply Last reply
        1

        • Login

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