在#include< threads.h> gt; gt; gt; gt; gt; gt; gt; GCC;在Debian
我正在尝试编译我能够在其他几个Debian环境上编译的程序“ GCC(Debian 10.2.1-6)10.2.1 20210110
”
命令
gcc -o< pregname> -o3 -wall -wextra -sstd = c11 -lpthread< sourcefile>
,我以链接器错误的形式获得了一串链接器错误 未定义的引用'mtx_unlock'
以及mtx_lock
mtx_init
thrd_create
等不存在。我尝试从编译命令中删除-lpthread
参数,但这并没有改变。
怎么了?
I'm trying to compile a program that I've been able to compile on several other Debian environments with no issues using the C11 <threads.h>
library on a relatively fresh install of Debian Bullseye with "gcc (Debian 10.2.1-6) 10.2.1 20210110
" installed
with the command
gcc -o <progname> -O3 -Wall -Wextra -std=c11 -lpthread <sourcefile>
and I'm getting a string of linker errors in the form ofundefined reference to 'mtx_unlock'
as well as mtx_lock
mtx_init
thrd_create
etc.
But I'm not getting an error saying the threads.h
file is absent. I tried removing the -lpthread
argument from the compilation command but this changed nothing.
What is going wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正确的命令行参数似乎是
-pthread
,没有l
。The correct command line parameter seems to be
-pthread
without thel
.