使用-lpthread标志时未定义的对'pthread_init'的引用: [英] Undefined Reference to `pthread_init' When Using -lpthread Flag:

查看:156
本文介绍了使用-lpthread标志时未定义的对'pthread_init'的引用:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编译使用:

gcc -o outfile infile.c -lpthread



,唯一未定义的引用是 pthread_init



使用 -pthread 而不是 -lpthread ,根据在线的一些建议。



I am 包括< pthread.h>



想法?

解决方案

不要调用 pthread_init()。在Linux上这不是必需的。


I'm compiling using:

gcc -o outfile infile.c -lpthread

and the only undefined reference is pthread_init.

I have tried using -pthread instead of -lpthread, as per some suggestions online.

I am including <pthread.h>

Any ideas?

解决方案

Don't call pthread_init(). It's not necessary on Linux.

这篇关于使用-lpthread标志时未定义的对'pthread_init'的引用:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆