LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 773|回复: 1

我的线程程序怎么没有办法编译呀?

[复制链接]
发表于 2004-3-5 00:51:23 | 显示全部楼层 |阅读模式
[root@Center srchftp]# more a.c
#include"unixnet.h"
void * a(void*arg){};
pthread_t pid;
int main()
{
        pthread_create(&pid,NULL,a,NULL);
        exit(0);
}

[root@Center srchftp]# gcc a.c
/tmp/ccMx8kCI.o(.text+0x24): In function `main':
: undefined reference to `pthread_create'
collect2: ld returned 1 exit status
[root@Center srchftp]#
具体情况就是上面的那个情况,请问大家,怎么处理呀?
 楼主| 发表于 2004-3-5 10:20:57 | 显示全部楼层
搞定了,原来编译的时候要加上参数
-lpthread
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表