简体   繁体   中英

Qt for wasm: error: use of undeclared identifier 'QThreadPool'

I'm trying to build my desktop Qt application for Web Assembly and I encountered the problem with threads.

When I use QThreadPool I get "use of undeclared identifier 'QThreadPool'" error message. When I use QThread there are no error messages but the thread doesn't start when start() is called.

How can I compile Qt application with threads for Web Assembly?

I'm not sure how exactly you're compiling this right now, but maybe it would be good to update your answer to show exactly what version your QT is and your compilation setup.

To me it seems that many features of QT aren't supported yet on WASM and this is expected! It looks like they are still porting most of the functionality to the Web and it could take some time.

If you check the QTBUG-64700 you will see that the threading support is not yet available for WASM (see the pthread issue QTBUG-64625 ). The current WebAssembly design plan suggests that this will be a couple of months before Pthread like threads are implemented.

For more info on the status of QT for WASM I'd check out their blog post where it also states the currently unsuported features, and shows some examples of currently working ones. Or see below for a quick summary of the current main issues.

Things that don't work QTBUG-63917 (as of 2018/05/22)

Multithreading QTBUG-64700

  • there is a stub QThread
  • disabled in the browsers due to the Spectre vulnerability

Most QNetwork QTBUG-63920

  • no DNS lookups due to javascript sandbox
  • simple QNAM requests should work.

Local Filesystem access QTBUG-67834

persistent QSettings, it syncs the config rather slow and asynchronously QTBUG-63923

QOpenGLWIdget QTBUG-66944

Opengl only works fullscreen QTBUG-67717

some shaders QTBUG-67338

  • QResource fails to find shaders built-in to Qt

The exec loop does not function like other platforms QTBUG-64020

  • exec() event loop will not return where you expect it to
  • Returning values from modal dialogs are known not to work but can be worked around by using non-modal signals and show(). Although modal dialogs/windows will still open.

toUpperCase QTBUG-66621

QClipboard QTBUG-64638


I'm sure there will be more updates and improvements soon, but it looks like you will have to wait!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM