qmake subdirs project
I read about subdirs project and wanted to apply this nice feature to my project. But I got some "undefined reference to vtable" errors. I think this comes because I made something wrong.
My Project has multiple applications and librarys and has a directory hierarchy like this:
I added for each directory a .pro-file. My root .pro-file looks like this:
TEMPLATE = subdirs SUBDIRS += applications librarys applications.depends = librarys
The .pro-file in the librarys directory looks like this:
TEMPLATE = subdirs SUBDIRS += plugins systemdependent utilities plugins.depends = utilities systemdependent.depends = utilities
The .pro-file in the utilities directory looks like this:
TEMPLATE = subdirs SUBDIRS += firstUtilitiesLib secondUtilitiesLib thirdUtilitiesLib firstUtilitiesLib .depends = secondUtilitiesLib thirdUtilitiesLib.depends = secondUtilitiesLib
The whole librarys branch builds without any error. Even myGpioLibForLinux which depends on secondsUtilitiesLib builds without an error. But every project in the applications branch which depends on one of the librarys fails with "undefined reference to vtable" errors.
Do I need to create just one big subdirs .pro-file in the root directory or can I stay at my method with one subdirs .pro-file for every directory? Do the errors come from wrong usage of the subdirs or do I have another problem (everything build without errors befor!)?
PS: what are the new code-tags here??
How do your
applicationsproject files look like? Do they link your built libraries with
LIBS +=? The
dependsdirective only gives information about the order of building your projects but not about linking libraries.
ps: You can find the new code styles here (it's markdown): https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code
dependsdont give informations about how to link, why can I compile the whole library branch?
I have one base library and every other library has to link against this (base lib in my example: secondUtilitiesLib).
So why can I compile every lib based on secondUtilitiesLib without any
LIBS +=but in the applications branch it fails?
@kDohmen Are you building static or dynamic libraries (for static libraries the header files might be enough to compile them)?
You can also manually check the generated Makefiles if all linker flags are set up correctly for your
@alexvplay Ok, you were right. I had to add the librarys with
I think this should be descibed better in the documentation.