未定义的对符号“sem_post@@GLIBC_2.4”的引用。

时间:2021-11-03 05:29:02

I am trying to build a sample code using Eclipse and ARM Sourcery Windows GCC C on Windows 8 machine. When I compile code : I get this error :

我正在尝试在Windows 8机器上使用Eclipse和ARM Sourcery Windows GCC C构建一个示例代码。当我编译代码时:我得到这个错误:

Undefined reference to symbol 'sem_post@@GLIBC_2.4

未定义的对符号“sem_post@@GLIBC_2.4”的引用。

The error doesn't say any line number or any location about the error, so I don't know which part of the code I should post. How can I get rid of this error? Thanks.

错误并没有说任何行号或错误的位置,所以我不知道应该在哪个部分上发布。我怎样才能摆脱这个错误呢?谢谢。

1 个解决方案

#1


8  

sem_post() lives in the pthread library, so make sure you use the -pthread flag when compiling and linking.

sem_post()生活在pthread库中,所以在编译和链接时要确保使用-pthread标记。

#1


8  

sem_post() lives in the pthread library, so make sure you use the -pthread flag when compiling and linking.

sem_post()生活在pthread库中,所以在编译和链接时要确保使用-pthread标记。