error: syntax error before "pthread_rwlock_t"

写好的代码,在另外一个平台编译,出错,犹如上提示,两个环境的编译器版本不一样, 搜到解决办法如下 两台机器,一台编译正常,另一台报错: error: syntax error before "pthread_rwlock_t" 仔细查看发现编译正常的机器gcc版本是gcc version 4.1.2,报错的gcc版本是gcc version 3.4.6 继续搜索,发现pthread_rwlock_t 在pthreadtypes.h文件中有定义: ... #if defined __USE_UNIX98 || defined __USE_XOPEN2K /* Functions for handling read-write locks. */ /* Initialize read-write lock RWLOCK using attributes ATTR, or use the default values if later is NULL. */ extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock, __const pthread_rwlockattr_t *__restrict __attr) __THROW __nonnull ((1)); ... 编译时加上参数 -D_XOPEN_SOURCE=500 或者 在文件中define __USE_UNIX98 或者__USE_XOPEN2K 500 转自:http://hi.baidu.com/algol_dream/blog/item/6190b1c2810a5d40b319a89d.html

转载于:https://www.cnblogs.com/fly-fish/archive/2011/07/19/2110726.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值