Reputation: 111
I have an exemplar program that fails to 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]$
Upvotes: 11
Views: 9289
Reputation: 283614
The Read-Write locks are non-standard, and are conditionally defined in <pthread.h>
.
-std=c99
requests close compliance to the Standard (as much as possible), and disables both language extensions and extra libraries.
If you instead pass std=gnu99
, you will get the C99 compiler version and also all the extensions and extras provided by gcc by default.
Upvotes: 26