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. Two libs, one lib adds functionality to the other if present?
Qt 6.11 is out! See what's new in the release blog

Two libs, one lib adds functionality to the other if present?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 514 Views 1 Watching
  • 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.
  • M Offline
    M Offline
    MrShawn
    wrote on last edited by
    #1

    Hello,

    Right now I have two libraries that I want to include in my project (I have written both). One library is for messaging across applications, the other is a utility library with a subset of error handling capabilities.

    I want my message library to have the ability to use some of the error handling classes if it is present by the calling application. The thing is I don't want to force the util library if I use the message library. I am asking for help to achieve this, just not sure how to do this.

    I have the project organized as a subdir project with both libraries added along with the calling application. I added a

    #if defined(ERROR_H)
    

    in a few placed on my message class' .h and .cpp file. It works well until the compiler goes to compile my dll for the messaging library and I get unresolved external symbols.

    I am using qmake for the build system on this project.

    Any help appreciated.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      What you want is not really achievable the way you want it. The only way to solve this is to use the util library as a plugin and load it on runtime (or not) and provide a fallback for the functions otherwise via an interface class.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • M Offline
        M Offline
        MrShawn
        wrote on last edited by
        #3

        Perfect, thanks. Doing the runtime plugin is more than I want to do at the current moment. Appreciate the answer.

        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