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]$
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With