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. Static qt question
Forum Updated to NodeBB v4.3 + New Features

Static qt question

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 1.2k 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.
  • A Offline
    A Offline
    ahura_24
    wrote on last edited by
    #1

    hi everybody
    i have one question. doest exist macro that tell me my qt library is static or dynamic ?
    tnx so much

    1 Reply Last reply
    0
    • B Offline
      B Offline
      butterface
      wrote on last edited by
      #2

      Such a macro cannot exist. Macros will be evaluated during the preprocessor step. It is not interesting for the preprocessor what happens later on. Also the compiler is not interested in that. The first one is the linker but then it is too late for macros.

      What for do you need the information. If it is statically linked your application itself will take care of using the already loaded functions. If dynamically linked the application is still in charge but is asks the OS where to search for the dll's/so's. If they are not there it won't work of course.

      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        This sort of thing is usually handled by a define passed to a compiler in the build system. I don't think Qt has something out of the box, but you can add it yourself.

        1 Reply Last reply
        0
        • hskoglundH Offline
          hskoglundH Offline
          hskoglund
          wrote on last edited by
          #4

          Well if you only need it for Windows, you could check for the presence of Qt's DLLs:
          @
          #include "windows.h"
          bool bStaticBuild = (!::GetModuleHandle(L"Qt5Core")) && (!::GetModuleHandle(L"Qt5Cored"));
          @

          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