我在将 Qt webengine 编译到 时遇到了很多麻烦启用专有编解码器 ,文档不是很清楚。我按照stackoverflow上的其他说明进行操作,但它不起作用。我收到如下错误:
Project ERROR: Cannot run compiler 'cl'. Output:
===================
===================
Maybe you forgot to setup the environment?
或者
Needs VS 2015 Update 3 with Cumulative Servicing Release or higher
Qt WebEngine will not be built.
或者
Could not detect Windows SDK Version ('WindowsSDKVersion' environment variable is not set).
Qt Webengine on Windows requires a Windows SDK version 10.0.10586 or newer.
QtWebEngine will not be built.
或者
Needs Visual Studio 2017 or Higher
Qt WebEngine will not be built.
或者
C1905: Front end and back end not compatible (must target same processor).
LNK1257: code generation failed
最佳答案
在过去的 5 天里,我遇到了所有这些问题。
如果您不知道如何开始编译 Qt webengine(使用或不使用专有编解码器),我将逐步说明。
如果你已经完成了一些步骤,你可以自由地跳过它们。
如果您看到任何错误,如果这样做有错误,或者如果某些说明不清楚,请告诉我,以便我更新
1.安装Visual Studio 2017
转至 https://www.visualstudio.com/fr/downloads/并下载 Visual Studio 2017。
当这个窗口出现时,检查Desktop Development for C++
并确保 VC++ toolset 2015.3v v14.00 (v140)
和 SDK Windows 10 (10.0.xxxxx.x)
被检查。
安装并等待它完成。
2.安装Qt源码qt webengine
打开MaintenanceTool.exe
出现在 Qt 文件夹中
添加或删除模块
请务必至少检查:MSVC 2015 32-bit
, MSVC 2015 64-bit
, MSVC 2017 64-bit
, Sources
, Qt WebEngine
安装并等待它完成。
3.安装Qt webengine compile prerequisities
(从 this thread 上的 Sébastien Bémelmans 复制的原始说明并稍作修改)
下载:
确保将每个 .exe 添加到系统路径,然后重新启动计算机。
4. 使用专有编解码器(或不使用)编译 Qt webengine
打开
cmd.exe
(具有管理员权限)。类型
cd
+ Microsoft Visual Studio 文件夹的路径,其中 vcvarsall.bat
位于:cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"
编译成 32 位:
输入
vcvars32.bat
进入命令行编译成 64 位:
输入
vcvars64.bat
进入命令行进入Qt的Sources所在路径,进入qtwebengine子目录:
cd "C:\Qt\5.11.0\Src\qtwebengine"
编译成 32 位:
输入
"C:\Qt\5.11.0\msvc2015\bin\qmake.exe" -- -webengine-proprietary-codecs
进入命令行(注意链接将指向 msvc 2015 32 位)编译成 64 位:
输入
"C:\Qt\5.11.0\msvc2017_64\bin\qmake.exe" -- -webengine-proprietary-codecs
进入命令行(注意链接将指向 msvc 2017 64 位)您的控制台应如下所示(32 位):
结果:
现在你需要调用nmake。键入“32 位或 64 位版本的 nmake.exe 的路径”,如下所示:
编译成 32 位:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx86\x86\nmake.exe"
进入命令行(注意x86进入路径)编译成 64 位:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x64\nmake.exe"
进入命令行(注意 x64 进入路径)Your command line should now output a lot of things. Compiling qt webengine requires lot of memory and space (around 90 Go on my computer and 60% of my 8 GO of RAM). Be sure to have place and free memory. It is long processing too
关于visual-studio - 如何使用专有编解码器在 Windows 上编译 Qt webengine (5.11),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50510457/