Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Qt cannot find constants into an included header <SOLVED>

    General and Desktop
    2
    3
    1329
    Loading More Posts
    • 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
      alexandros last edited by

      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 Reply Quote 0
      • Chris Kawa
        Chris Kawa Moderators last edited by

        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 Reply Quote 0
        • A
          alexandros last edited by

          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 Reply Quote 0
          • First post
            Last post