写好的代码,在另外一个平台编译,出错,犹如上提示,两个环境的编译器版本不一样, 搜到解决办法如下 两台机器,一台编译正常,另一台报错: 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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2021-04-11
  • 2021-09-25
  • 2021-10-20
猜你喜欢
  • 2021-06-29
  • 2022-12-23
  • 2021-11-21
  • 2021-06-07
  • 2022-12-23
  • 2021-06-20
相关资源
相似解决方案