c++ - 未找到 Qt 5.12 D3D 编译器模块
问题描述
我已经安装了 Qt 5.12 ,当我想编译我的项目时显示此错误:
错误:
QOpenGLShaderProgram::uniformLocation(qt_Matrix): shader program is not linked
ensureInitialized(141): D3D compiler module not found.
QOpenGLShader::link: D3D compiler module not found.
shader compilation failed:
"D3D compiler module not found.\n"
解决方案
欢迎来到 SO!
首先,让我们澄清一下错误的含义。
Qt 在 Windows 上使用ANGLE,这是一个允许在 OpenGL 不可用的系统上运行 OpenGL 软件的层,方法是将 OpenGL 调用转换为 DirectX 调用。Qt 根据机器的配置(显卡型号、显卡驱动版本等)决定是使用纯 OpenGL 还是 ANGLE。有关这方面的更多详细信息,请访问https://wiki.qt.io/Qt_5_on_Windows_ANGLE_and_OpenGL。
即使您自己没有编写任何 OpenGL 代码,qml 运行时肯定也有很多 OpenGL 调用,可能再次通过 ANGLE。
这就是为什么会出现令人困惑的错误消息(在处理 OpenGL 代码时寻找 D3D 着色器编译器!)。
现在,Qt 项目bugtracker报告了与https://bugreports.qt.io/browse/QTBUG-71510相同的问题,尽管在撰写本文时尚未提供解决方案。我建议不时查看 bugtracker 以监控此问题的进展。
您可以尝试几种解决方法:
- 将 d3dcompiler_xx.dll 复制到你的 exe 所在的同一目录中;
- 通过将环境变量QT_OPENGL设置为桌面,强制 Qt 使用 OpenGL 而不是 DirectX (更多详细信息请参见http://doc.qt.io/qt-5/windows-requirements.html)
推荐阅读
- c - 如何通过 Windows 批处理文件将值传递给 scanf()
- javascript - 如何只触发一次鼠标滚轮滚动
- tcl - Tcl 同时秒表和计数器不工作
- report - Snakemake 报告:在报告中包含 html 报告
- amazon-web-services - OpenVPN 未解析 HTTP/s 请求 - 连接到授权 VPN 时无法访问 AWS 私有 API 网关的端点
- firebase - OAuth2 client_id 检索,而不是来自控制台
- php - Laravel 6 - 如何让用户明天和以后不能使用
- c# - 内存使用和操作图像
- python - 如何使 Dijkstra 的算法报告该最短路线的完整最终距离
- java - 关闭应用程序时广播接收器不起作用