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. Can Qt access windows SDK functions in a third party static libraries?
Forum Update on Monday, May 27th 2025

Can Qt access windows SDK functions in a third party static libraries?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.8k 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.
  • U Offline
    U Offline
    Uddo_ud
    wrote on last edited by
    #1

    Hi,

    I'm implementing a function to open a window in Qt using a static library call. But the library gives linker errors and found the cause for this is a failure to call windows SDK functions. Tried removing only those function and the linker issues gone.

    Example:
    ShowWindow() is a function I'm using and it has defined in WinUser.h file. I tried including WinUser.h to my source files. Nothing happens.

    If Qt can access the third party libraries, why only the functions related to windows are getting failed?

    Also the windows SDK used in Qt and Visual Stuido 2015 (used to build libraries) are having the same windows SDK version (10.0.17134.0).

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

      According to msdn ( https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-showwindow ) you have to link against user32.lib - are you sure you added this to your LIBS var (I assume you're using qmake)

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

      U 1 Reply Last reply
      5
      • Christian EhrlicherC Christian Ehrlicher

        According to msdn ( https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-showwindow ) you have to link against user32.lib - are you sure you added this to your LIBS var (I assume you're using qmake)

        U Offline
        U Offline
        Uddo_ud
        wrote on last edited by
        #3

        @Christian-Ehrlicher

        Yes I'm using qmake. Also I added 32libs. But same issues still there.

        This is my error log

        0_1545909036081_4fd46972-ba5d-4ee2-811a-e7c9487134fd-image.png

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

          @Uddo_ud said in Can Qt access windows SDK functions in a third party static libraries?:

          Also I added 32lib

          You must add user32.lib - please show us your .pro file

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

          U 1 Reply Last reply
          2
          • Christian EhrlicherC Christian Ehrlicher

            @Uddo_ud said in Can Qt access windows SDK functions in a third party static libraries?:

            Also I added 32lib

            You must add user32.lib - please show us your .pro file

            U Offline
            U Offline
            Uddo_ud
            wrote on last edited by
            #5

            @Christian-Ehrlicher

            win32:LIBS += -L"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x86" -lUser32

            I added this and the issues solved. Thank you @Christian-Ehrlicher for the support.

            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