Chinaunix首页 | 论坛 | 博客
  • 博客访问: 658017
  • 博文数量: 135
  • 博客积分: 5217
  • 博客等级: 大校
  • 技术积分: 1289
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-05 17:36
文章分类

全部博文(135)

文章存档

2016年(1)

2012年(5)

2011年(15)

2010年(63)

2009年(51)

分类: LINUX

2010-10-25 09:26:19


在网上搜索都一直没有发现这个问题的解释!

---几天在新闻组上看到的帖子如下:
  也是我一直没时间搞清楚的东西

by Lew Pitcher lpitcher@teksavvy.com
In GCC, the -pthread (aka -pthreads) option manages both the compiler
preprocessor /and/ linker to enable compilation with Posix threads. The
preprocessor will define/enable/use Posix threads versions of some macros
(or perform conditional compilation to enable Posix threads logic), and the
linker will specifically link the resultant object against libpthread

However, -lpthread simply tells the linker to attempt to resolve any
external references against the libpthread library, in the same way
that -lm tells the linker to attempt to resolve any external references
against the libm library. For -lpthread, your code might not contain
external references to libpthread, even if you wrote Posix thread code,
because the critical macros haven't been switched on.



阅读(918) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~