linux – GCC编译失败,使用pthread和选项std = c99

linux – GCC编译失败,使用pthread和选项std = c99,第1张

概述我有一个示例程序无法使用-std = c99进行编译 任何帮助赞赏 #include <pthread.h>int main(void) { pthread_rwlock_t myLock; return 0;}output of the two compiles:gcc pthread_test.c[brad@fedora17onbradsmacpro src] 我有一个示例程序无法使用-std = c99进行编译

任何帮助赞赏

#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.cpthread_test.c: In function ‘main’:pthread_test.c:5:2: error: unkNown type name ‘pthread_rwlock_t’[brad@fedora17onbradsmacpro src]$
解决方法 读写锁是非标准的,并且在< pthread.h>中有条件地定义.

-std = c99请求严格遵守标准(尽可能多),并禁用语言扩展和额外库.

如果您改为传递std = gnu99,您将获得C99编译器版本以及默认情况下gcc提供的所有扩展和附加功能.

总结

以上是内存溢出为你收集整理的linux – GCC编译失败,使用pthread和选项std = c99全部内容,希望文章能够帮你解决linux – GCC编译失败,使用pthread和选项std = c99所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1039913.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存