在#include< threads.h> gt; gt; gt; gt; gt; gt; gt; GCC;在Debian

发布于 2025-01-22 04:25:42 字数 414 浏览 3 评论 0原文

我正在尝试编译我能够在其他几个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 of
undefined 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

紫轩蝶泪 2025-01-29 04:25:42

正确的命令行参数似乎是-pthread,没有l

The correct command line parameter seems to be -pthread without the l.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文