找不到“pthread_setaffinity_np”?
我使用-pthread作为gcc编译器,但仍然找不到这个API。有什么建议吗?
I used -pthread for gcc compiler, but still can not find this API. any suggestion?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如手册和后缀
_np
会告诉您的那样,它是一个非标准 GNU 扩展,因此请包含如下标头:It's a non-standard GNU extension, as the manual and the suffix
_np
will tell you, so include the header like this:您的命令必须如下所示...
$ > gcc -lpthread YourProg.c
如果是 .cpp
则>>
$> g++ -lpthread YourProg.cpp
Your command must looks like this way...
$ > gcc -lpthread YourProg.c
if it is .cpp
then >>
$ > g++ -lpthread YourProg.cpp
因为它不是 posix 函数,所以也许你可以在某个地方使用它,而你不能在其他地方使用它。
所以要小心使用它。
because it is not a posix function,so maybe you can use it in somewhere,and you can not use it in some other where.
So carefully use it.