Important: Please read the Qt Code of Conduct -

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

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

  • Lifetime Qt Champion

    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.

  • @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.

Log in to reply