Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Late binding of library QObject causes error in client app
QtWS25 Last Chance

Late binding of library QObject causes error in client app

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 561 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ad5xj
    wrote on last edited by
    #1

    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.

    Ken AD5XJ

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ckakman
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved