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. Unresolved external symbol with Qt6
Forum Updated to NodeBB v4.3 + New Features

Unresolved external symbol with Qt6

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.1k 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.
  • L Offline
    L Offline
    LokiNinja
    wrote on last edited by
    #1

    Hi, I am trying to build a Qt6 project on windows 10. I am using conan for dependency management (so thats what is pulling in Qt) and cmake with a VS generator. I am getting the following linker error though:

    Qt6Guid.lib(qrhid3d11.cpp.obj) : error LNK2019: unresolved external symbol DCompositionCreateDevice referenced in function "public: bool __cdecl QRhiD3D11::ensureDirectCompositionDevice(void)" (?ensureDirectCompositionDevice@QRhiD3D11@@QEAA_NXZ)

    So it looks like its having trouble linking to D3D11. From my understanding, it shouldn't need me to explicitly link to that as the VS generator automatically knows where the Windows SDK is and QT should have that linked in its distro anyways. Any Idea what to do here?

    C 1 Reply Last reply
    0
    • L LokiNinja

      Hi, I am trying to build a Qt6 project on windows 10. I am using conan for dependency management (so thats what is pulling in Qt) and cmake with a VS generator. I am getting the following linker error though:

      Qt6Guid.lib(qrhid3d11.cpp.obj) : error LNK2019: unresolved external symbol DCompositionCreateDevice referenced in function "public: bool __cdecl QRhiD3D11::ensureDirectCompositionDevice(void)" (?ensureDirectCompositionDevice@QRhiD3D11@@QEAA_NXZ)

      So it looks like its having trouble linking to D3D11. From my understanding, it shouldn't need me to explicitly link to that as the VS generator automatically knows where the Windows SDK is and QT should have that linked in its distro anyways. Any Idea what to do here?

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      This looks more like you are trying to build Qt itself.
      What are the linker commands and output leading up to this failure?

      L 2 Replies Last reply
      0
      • C ChrisW67

        This looks more like you are trying to build Qt itself.
        What are the linker commands and output leading up to this failure?

        L Offline
        L Offline
        LokiNinja
        wrote on last edited by LokiNinja
        #3

        @ChrisW67 Im just using conan to get the dependency package, it doesn't do any building. Then it sets things up in a nice Cmake namespace. Only code regarding qt in the cmake file is this single line adding it to the link libraries:

        add_library(QtGUIImpl STATIC ${SOURCE} ${HEADERS}
        )
        
        target_link_libraries(QtGUIImpl CONAN_PKG::qt)
        

        Then just run the cmake --build .

        I link all sorts of other conan packages the same way and never faced any issues. For example this link gtest just fine and I do the same with spdlog:

        target_link_libraries(SpdlogImplTest CONAN_PKG::gtest SpdlogImpl Utilities)
        

        I wonder if the conan package in their artifactory is actually broken.

        1 Reply Last reply
        0
        • C ChrisW67

          This looks more like you are trying to build Qt itself.
          What are the linker commands and output leading up to this failure?

          L Offline
          L Offline
          LokiNinja
          wrote on last edited by LokiNinja
          #4

          @ChrisW67 Looks like the conan package is broken. I had to explicitly link with a dcomp.lib windows library, but that fixed it. Did a search in the windows docs for the missing symbol and just copy and pasted its static lib. Whether or not this runs is a different story:

          target_link_libraries(QtGUIImpl CONAN_PKG::qt Dcomp.lib)
          
          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