GCC compilation fails with pthread and the std = c99 option

I have an example program that does not compile with -std = c99

any help appreciated

#include <pthread.h> int main(void) { pthread_rwlock_t myLock; return 0; } output of the two compiles: gcc pthread_test.c [ brad@fedora17onbradsmacpro src]$ gcc pthread_test.c [ brad@fedora17onbradsmacpro src]$ gcc -std=c99 pthread_test.c[ brad@fedora17onbradsmacpro src]$ gcc -std=c99 pthread_test.c pthread_test.c: In function 'main': pthread_test.c:5:2: error: unknown type name 'pthread_rwlock_t' [ brad@fedora17onbradsmacpro src]$ 
+7
source share
1 answer

Read-write locks are non-standard and conditionally defined in <pthread.h> .

-std=c99 requests close conformance to the standard (as far as possible) and disables both language extensions and additional libraries.

If you pass std=gnu99 , you will get the C99 compiler version, as well as all extensions and add-ons provided by gcc by default.

+20
source

All Articles