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.
Multithreading QTBUG-64700
Most QNetwork QTBUG-63920
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
The exec loop does not function like other platforms QTBUG-64020
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.