开发者

Can not find `pthread_setaffinity_np'?

开发者 https://www.devze.com 2023-04-01 15:35 出处:网络
I used -pthread for gcc compiler, but still 开发者_C百科can not find this API. any suggestion?It\'s a non-standard GNU extension, as the manual and the suffix _np will tell you, so include the header

I used -pthread for gcc compiler, but still 开发者_C百科can not find this API. any suggestion?


It's a non-standard GNU extension, as the manual and the suffix _np will tell you, so include the header like this:

#define _GNU_SOURCE
#include <pthread.h>


Your command must looks like this way...

$ > gcc -lpthread YourProg.c

if it is .cpp

then >>

$ > g++ -lpthread YourProg.cpp


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号