Linux下undefined reference to ‘pthread_create’问题解决
2016-02-18 15:23
537 查看
问题的原因:pthread不是Linux下的默认的库,也就是在链接的时候,无法找到phread库中的函数的入口地址,于是链接会失败。
解决:在gcc编译的时候,附加要加 -lpthread参数即可解决。
解决:在gcc编译的时候,附加要加 -lpthread参数即可解决。
root@ubuntu:/test/linux/20160218# gcc threadid.c /tmp/cc2buUlJ.o: In function `main': threadid.c:(.text+0x2e6): undefined reference to `pthread_create' collect2: ld returned 1 exit status root@ubuntu:/test/linux/20160218# gcc -lpthread threadid.c root@ubuntu:/test/linux/20160218# ./a.out main thread: pid 5720 tid 3077879488 (0xb774b6c0) new thread: pid 5720 tid 3077876592 (0xb774ab70) root@ubuntu:/test/linux/20160218#
相关文章推荐
- linux常用命令之七:Vim常用操作
- Linux 控制台重定向至Console口
- win7 远程桌面连接centos 6.5
- linux下可以和qq截屏比拟的工具hotshots
- linux awk命令详解
- linux 查看磁盘空间占用情况
- Linux查看系统的版本信息的命令
- linux Oops和Panic关系
- Linux多线程中使用信号
- LINUX下Navicat for MySQL的安装和破解
- 在基于CentOS的云主机上用vsftpd搭建FTP服务器
- Linux下mysql新建账号及权限设置
- Ubuntu之Gitlab、Gerrit、Jenkins协调工作配置之部分一:邮箱配置
- 切换svn账户的linux命令
- linux编辑器 vi的使用
- X86/ARM USB2.0/USB3.0转网口,支持Windows、Linux、Android、wince
- freeRadius客户端和服务器分别安装实验
- linux 脚本
- 实习第一天-------linux的基本命令
- 【笔记】linux下设置mysql允许远程连接