本页内容

调试 Qt WebAssembly 应用程序

若要使用 Chrome 调试 Qt WebAssembly 应用程序:

  1. 打开一个launch.json文件。有关更多信息,请参阅《调试 Qt 应用程序》。
  2. 选择“Add Configuration ”,然后选择“Qt: Debug Qt WASM with Chrome ”调试配置。

“preLaunchTask ”部分中的“Qt: WASM Start ”任务会检查所需的依赖项,并在必要时提示您进行安装。

调试多线程应用程序

对于multi-thread 的 Qt WebAssembly 应用程序,请在settings.json 中设置以下配置:

"livePreview.httpHeaders": {
    "Cross-Origin-Embedder-Policy": "require-corp",
    "Cross-Origin-Opener-Policy": "same-origin",
    "Accept-Ranges": "bytes"
}

否则,您可能会看到“SharedArrayBuffer 未定义”的错误。

另请参阅 《调试 Qt 应用程序》和《VS Code:调试》。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.