05-04-2012 01:17 PM - edited 05-04-2012 01:20 PM
I'm porting an app that uses 'pthreads' and I'm having trouble getting it to work with Playbook.
Firstly, I noticed there is a pthread.h but no pthread library.
Next, I enabled pthreads in the source and then the QNX headers are throwing this error:
usr/include/pthread.h:41:2: error: #error POSIX Threads needs P1003.1b-1993 or later
I noticed this error occurs when POSIX defined aren't defined. So I decided to define __EXT_POSIX1_199309. It didn't seem to resolve the error.
Anyone know the correct way to get pthreads working?
05-04-2012 02:36 PM - edited 05-04-2012 02:39 PM
Are you setting any special flags? I have pthreads in my code and it doesn't complain.
05-04-2012 07:57 PM - edited 05-05-2012 12:50 AM
No special flags that I am aware of. I looked for '-ansi' and it's not anywhere in my Makefile. Is there something else I should be looking for?
Also, should there be a pthread library? I can't find any in the NDK.
It looks like platforms.h wants -D_POSIX_C_SOURCE=199309 so that it can define the right POSIX. I added this is manually and it's working now. But not sure if that's the correct way to go about it. Should be done automatically, right?
Edit: I think it was due to GNU_SOURCE being defined?
05-05-2012 06:47 PM - edited 05-05-2012 06:48 PM
Looks like pthread was included in libc: