2013-03-28 17 views
7

で失敗私は-std = c99をGCCのコンパイルがpthreadのとオプションのstd = c99を

で任意のヘルプのコンパイルに失敗した模範プログラムを持って読み書きロックが非標準で

#include <pthread.h> 
int main(void) { 
    pthread_rwlock_t myLock; 
    return 0; 
} 

output of the two compiles: 
gcc pthread_test.c 
[[email protected] src]$ gcc pthread_test.c 
[[email protected] src]$ 

gcc -std=c99 pthread_test.c[[email protected] 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’ 
[[email protected] src]$ 
+1

'-std = gnu99'についてはどうですか? –

答えて

20

を高く評価条件付きで<pthread.h>に定義されています。

-std=c99は、できるだけスタンダードに準拠するように要求し、言語拡張と追加のライブラリの両方を無効にします。

代わりにstd=gnu99を渡すと、デフォルトでgccによって提供されるC99コンパイラのバージョンとすべての拡張機能と追加機能が利用できます。

関連する問題