Linux线程编译是出现的“undefined reference to 'CPU_ZERO”

1、错误日志

 2、解决办法

先给出解答方案:

#define _GNU_SOURCE
#include <stdio.h>
#include <sched.h>
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>

注意在makefile中加上-lphread。

注意是  #define _GNU_SOURCE ,而不是 #define _GUN_SOURCE,大写U和N顺序不能颠倒。

原文地址:https://www.cnblogs.com/ggzhangxiaochao/p/13853573.html