Pthread.h missing include file

Pthread.h missing include file
0.0 0



I’ve created a simple HelloWorld app and wanted to try out threading. I found:

I pasted the code into HelloWorldScene.cpp but VS is complaining that it does not find the pthread include file.
Can you please tell me which file I need to include to get the pthread includes?

I can’t find it anywhere within the cocos installation - using cocos2d-x 3.14.1.

I also found a post explaining to use std::thread instead - that it is more portable. Why? On which platforms will pthread cause problems? Are there some ‘cocos’ threads (beside pthreads) I can/should use?

Best regards,


Background code execution?

This doc is really old. use std::thread


I did, thanks!

Maybe if someone could write in the link: pthread is deprecated, use std::thread instead :wink: