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. Qt cannot find constants into an included header <SOLVED>
Forum Update on Monday, May 27th 2025

Qt cannot find constants into an included header <SOLVED>

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.5k 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
    alexandros
    wrote on 14 Jan 2014, 10:39 last edited by
    #1

    I am trying to build an application in Windows 7 with MinGW that uses

    @IID_IShellDispatch@
    and
    @CLSID_Shell@

    I get an undefined reference for these, although I can clearly see them inside ShlDisp.h and Qt does auto-fill them when I start typing them.

    I have included ShlDisp.h and linked to shell32 (according to http://msdn.microsoft.com/en-us/library/windows/desktop/gg537707(v=vs.85).aspx)
    @#include <ShlDisp.h>@

    In my .pro file:

    @LIBS += -lshell32 -loleaut32 -lole32@

    The final command executed seems to be:

    @g++ -Wl,-subsystem,windows -mthreads -o debug\wallch.exe object_script.wallch.Debug -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmaind -lshell32 -loleaut32 -lole32 -LC:\Qt\Qt5.2.0\5.2.0\mingw48_32\lib -lQt5Widgetsd -lQt5Networkd -lQt5Guid -lQt5Cored@

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on 14 Jan 2014, 13:39 last edited by
      #2

      A quick objdump run sheds some light on the matter.
      In Windows SDK IID_IShellDispatch is defined inside uuid.lib and it needs to be linked to work (MS documentation seems to miss this information).
      Mingw provides its own copy of windows sdk libs and headers and although it's declared in shldisp.h as external, it's not actually defined in any of the libs, not even in libuuid.a. I don't know if it's a bug of theirs or just the pre-built packages are misconfigured, but that's how it is.

      So my advice would be to install the MS Windows SDK and link to the libs from there by
      @
      LIBS += -L"Path to SDK" -lshell32 -luuid
      @
      Mingw doesn't seem to mind linking to .libs from there.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alexandros
        wrote on 14 Jan 2014, 16:39 last edited by
        #3

        Thanks :) This solved it!

        Final line into the .pro file is:

        @LIBS += -L"C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib" -loleaut32 -lshell32 -luuid -lole32@

        1 Reply Last reply
        0

        1/3

        14 Jan 2014, 10:39

        • Login

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