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. cannot find -ld3d12
Forum Updated to NodeBB v4.3 + New Features

cannot find -ld3d12

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 608 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.
  • P Offline
    P Offline
    pistachio
    wrote on last edited by pistachio
    #1

    I am trying to run a project that I just opened on Windows 10 using cmake and I have not made any changes to it. When I press the build project button, I get the error below. Linker seems to find d3d11 but not d3d12.

    15:41:08: Running steps for project c...
    15:41:09: Starting: "C:\Qt\Tools\CMake_64\bin\cmake.exe" --build C:/Users/User/Desktop/build-c-Desktop-Debug --target all
    [1/1 2.6/sec] Linking CXX executable c.exe
    FAILED: c.exe 
    cmd.exe /C "cd . && C:\PROGRA~1\MINGW-~1\X86_64~1.0-P\mingw64\bin\G__~1.EXE -DQT_QML_DEBUG -g -mwindows CMakeFiles/c.dir/c_autogen/mocs_compilation.cpp.obj CMakeFiles/c.dir/main.cpp.obj CMakeFiles/c.dir/mainwindow.cpp.obj -o c.exe -Wl,--out-implib,libc.dll.a -Wl,--major-image-version,0,--minor-image-version,0  C:/Qt/6.6.1/mingw_64/lib/libQt6Widgets.a  C:/Qt/6.6.1/mingw_64/lib/libQt6Gui.a  C:/Qt/6.6.1/mingw_64/lib/libQt6Core.a  -lmpr  -luserenv  -lmingw32  C:/Qt/6.6.1/mingw_64/lib/libQt6EntryPoint.a  -lshell32  -ld3d11  -ldxgi  -ldxguid  -ld3d12  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
    C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ld3d12
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    15:41:09: The process "C:\Qt\Tools\CMake_64\bin\cmake.exe" exited with code 1.
    Error while building/deploying project c (kit: Desktop)
    When executing step "Build"
    15:41:09: Elapsed time: 00:01.
    
    

    I get the same error when I put the full path of d3d12, dxgi and d3dcompiler in the CMakeLists.txt file. I am sure the path is correct. How can I fix this?

    target_link_libraries(c PRIVATE
        "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/x64/d3d12.lib"
        "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/x64/dxgi.lib"
        "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/x64/d3dcompiler.lib"
        Qt${QT_VERSION_MAJOR}::Widgets
    )
    

    I tried this first and also didn't work

    target_link_libraries(c PRIVATE
        d3d12
        Qt${QT_VERSION_MAJOR}::Widgets
    )
    
    Christian EhrlicherC 1 Reply Last reply
    0
    • P pistachio

      I am trying to run a project that I just opened on Windows 10 using cmake and I have not made any changes to it. When I press the build project button, I get the error below. Linker seems to find d3d11 but not d3d12.

      15:41:08: Running steps for project c...
      15:41:09: Starting: "C:\Qt\Tools\CMake_64\bin\cmake.exe" --build C:/Users/User/Desktop/build-c-Desktop-Debug --target all
      [1/1 2.6/sec] Linking CXX executable c.exe
      FAILED: c.exe 
      cmd.exe /C "cd . && C:\PROGRA~1\MINGW-~1\X86_64~1.0-P\mingw64\bin\G__~1.EXE -DQT_QML_DEBUG -g -mwindows CMakeFiles/c.dir/c_autogen/mocs_compilation.cpp.obj CMakeFiles/c.dir/main.cpp.obj CMakeFiles/c.dir/mainwindow.cpp.obj -o c.exe -Wl,--out-implib,libc.dll.a -Wl,--major-image-version,0,--minor-image-version,0  C:/Qt/6.6.1/mingw_64/lib/libQt6Widgets.a  C:/Qt/6.6.1/mingw_64/lib/libQt6Gui.a  C:/Qt/6.6.1/mingw_64/lib/libQt6Core.a  -lmpr  -luserenv  -lmingw32  C:/Qt/6.6.1/mingw_64/lib/libQt6EntryPoint.a  -lshell32  -ld3d11  -ldxgi  -ldxguid  -ld3d12  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
      C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ld3d12
      collect2.exe: error: ld returned 1 exit status
      ninja: build stopped: subcommand failed.
      15:41:09: The process "C:\Qt\Tools\CMake_64\bin\cmake.exe" exited with code 1.
      Error while building/deploying project c (kit: Desktop)
      When executing step "Build"
      15:41:09: Elapsed time: 00:01.
      
      

      I get the same error when I put the full path of d3d12, dxgi and d3dcompiler in the CMakeLists.txt file. I am sure the path is correct. How can I fix this?

      target_link_libraries(c PRIVATE
          "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/x64/d3d12.lib"
          "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/x64/dxgi.lib"
          "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/x64/d3dcompiler.lib"
          Qt${QT_VERSION_MAJOR}::Widgets
      )
      

      I tried this first and also didn't work

      target_link_libraries(c PRIVATE
          d3d12
          Qt${QT_VERSION_MAJOR}::Widgets
      )
      
      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You have to link against MinGW import libs, not MSVC ones. You can not mix them.

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

      P 1 Reply Last reply
      3
      • Christian EhrlicherC Christian Ehrlicher

        You have to link against MinGW import libs, not MSVC ones. You can not mix them.

        P Offline
        P Offline
        pistachio
        wrote on last edited by
        #3

        @Christian-Ehrlicher Thank you, I installed MSVC and everything is working now but I wonder, Is the official version of these libraries for MinGW available?

        C 1 Reply Last reply
        0
        • P pistachio

          @Christian-Ehrlicher Thank you, I installed MSVC and everything is working now but I wonder, Is the official version of these libraries for MinGW available?

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

          @pistachio MingW is supposed to have included DirectX 12 headers/libraries since version 8.0. Perhaps an upgrade is needed.

          Do relevant files exist within your MingW install (even though CMake does not find them) ?

          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