Add the following lines to the beginning of your code
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <sched.h>
You could find out which header files and/or macros are needed by
man 2 syscall_name
man 3 library_function_name
By the way, the implication of _GNU_SOURCE
and more could be find out by man 7 feature_test_macros
.