码迷,mamicode.com
首页 > 其他好文 > 详细

pthread.h 的 undefined reference to `pthread_create'

时间:2016-10-21 19:11:09      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:参数   include   define   执行   math   thread   mat   不同   undefined   

在编译中要加 -lpthread或-pthread参数(不同版本的gcc可能不一样,man gcc可以查阅对应参数)。

例如:在加了头文件#include <pthread.h>之后执行 pthread.c文件,需要使用如下命令:

    gcc -lpthread -o thread thread.c

    gcc -pthread -o thread thread.c

这种情况类似于<math.h>的使用,需在编译时加 -m 参数。

pthread.h 的 undefined reference to `pthread_create'

标签:参数   include   define   执行   math   thread   mat   不同   undefined   

原文地址:http://www.cnblogs.com/bittorrent/p/5985372.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!