Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Late binding of library QObject causes error in client app
ad5xj last edited by
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:
In modem.cpp the class defines the object as:
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:
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.
ckakman last edited by
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.