Late binding of library QObject causes error in client app
-
I am creating a shared library (several actually) that is used by a client application. The problem is that when the client application is compiled it produces an error relating to the library:
@
undefined reference to Pactor::target() in libopenmodem.so
@In the modem.hpp the private section is defined with:
@private:
class PrivateData;
PrivateData *d_data;
@In modem.cpp the class defines the object as:
@
#include <pactor.hpp>
#include <winmor.hpp>class PrivateData
{
...
Pactor *pactor_codec;
WinMor *winmor_codec;
}
@Late in modem.cpp the object is created as:
@pactor_codec = new Pactor(this);@
All library modules compile and link without error.
If the description above is confusing let me offer a rough class diagram:
@client application
.
.
.
V
modem (shared lib)
^ ----------------------
| |
pactor (shared lib) winmor (shared lib)
^ ^
| |
sound and other libs (shared libs)
@The <QGlobals> is defined for the shared libraries and the import/export mechanism is present in the .hpp module interface definitions.
My question is whether the late binding (creation) of the object is the cause of the error from the client application or is it some not-so-obvious (to me anyway) method used in the modem library?
This is my first experience with creating custom libraries so any help would be appreciated.
-
Hi,
Could you check whether you link the client application to the library containing the Pactor class in the .pro file of the client application? You need something like
@LIBS += -L/path/to/dir/containing/pactor/lib -lpactor@or whatever the name of the library containing Pactor is. Note that -L is used for paths whereas -l is used for the library name.