资讯   |   开发   |   选机中心   |   产品大全 | IBM | 惠普 | 联想 | 戴尔 | 苹果 | 神舟
更多: | 华硕 | 明基 | 方正 | 紫光 | TCL | 夏新 | 联宝 | 宏碁 | 七喜 | 长城 | 清华同方 | 海尔 | 三星 | 东芝 | 索尼 | 富士通 | LG | 技术 | ddnoon
当前位置:笔记本 > 软件开发 >
Advertisement
文章正文

为什么pthread_create`编译通不过

类型:转载   责任编辑:asp.net   日期:2007/05/23


热门软件下载:


   

#include   <stdio.h>  
  #include   <stdlib.h>  
  #include   <pthread.h>  
  void   donothing()  
  {  
  }  
  int   main(int   argc,   char   *argv[])  
  {  
   
      pthread_t   thread;  
      pthread_create(&thread,NULL,(void*)donothing,NULL);  
  }  
   
  下面是编译命令:  
  [groupmerit@localhost   mutithread]$   gcc   -c   main.c  
  [groupmerit@localhost   mutithread]$   gcc   -o   main   main.o  
  main.o(.text+0x33):   In   function   `main:  
  :   undefined   reference   to   `pthread_create  
  collect2:   ld   returned   1   exit   status  
   
  为什么生成可执行文件会报pthread_create没定义  
   
   
   
   
 

网友回答:

发表者:pacman2000

gcc   -o   main   main.o   -lpthread  
  要连接库。


 

 
热门推荐笔记本: 海尔笔记本
相关文章:
webmaster:popbb@126.com   最佳浏览:1024X768 MSIE
©2007 popbb.net All Rights Reserved