Unable to add Internal Library to project even though its .pro file exists.
-
See this screen shot? There's nothing listed in the Library: combobox. I have a folder selected that is in the build tree on the left and it has a
functor.pro
file inside of it.How can I add an internal library to an Qt Widgets App?
-
Here, "Internal" means "within the same SUBDIRS project". This is not directly documented but is implied at https://doc.qt.io/qtcreator/creator-project-qmake-libraries.html#example-of-adding-internal-libraries
(See also https://doc.qt.io/qtcreator/creator-project-creating.html#adding-subprojects-to-projects)
You need a top-level SUBDIRS project that contains both your main
banana_cats_cpp
project and yourfunctor
project:# Root.pro TEMPLATE = subdirs SUBDIRS += \ /path/to/banana_cats_cpp \ /path/to/functor
Close everything, then re-open the
Root
project. In the Projects pane, right-clickbanana_cats_cpp
(which should now be nested underRoot
) and select Add Library....functor
should now be selectable as an Internal Library.Personally, I prefer to just use External Libraries
-
@JKSH interesting, how would you do an external library plugin?
-
@JKSH interesting, how would you do an external library plugin?
@enjoysmath said in Unable to add Internal Library to project even though its .pro file exists.:
interesting, how would you do an external library plugin?
Oh, a plugin?
Typically, an application searches for (optional) plugins at runtime; you don't need to add plugin libraries to your .pro file. See https://doc.qt.io/qt-5/qtwidgets-tools-echoplugin-example.html for a simple example.
Adding libraries to your project (either internal or external libraries) is typically done for required dependencies, not for plugins.
Let's take a step back: What's the purpose of these plugins? Do you want a plugin library, or do you just want a "regular" library?