Find the answer to your Linux question:
Results 1 to 6 of 6
Hi All Do not know if this the right forum, but I get the following undefined reference to `CPU_SET' though I have included <sched.h> Any ideas? Regards...
  1. #1
    Just Joined!
    Join Date
    Jan 2008
    Posts
    3

    Link error

    Hi All

    Do not know if this the right forum, but I get the following
    undefined reference to `CPU_SET'

    though I have included <sched.h>

    Any ideas?

    Regards

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Yes. Please post a tiny, complete (compilable) program which illustrates the problem, and post the exact command you used to compile it, and post the exact, full error message you got (not a paraphrase).
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    Just Joined!
    Join Date
    Mar 2009
    Posts
    2
    Quote Originally Posted by vardhasu View Post
    Hi All

    Do not know if this the right forum, but I get the following
    undefined reference to `CPU_SET'

    though I have included <sched.h>

    Any ideas?

    Regards
    Yes, you need to compile with the flag -D_GNU_SOURCE,

    so do:

    gcc -D_GNU_SOURCE yourfile.c

    Quote Originally Posted by wje_lf View Post
    Yes. Please post a tiny, complete (compilable) program which illustrates the problem
    This is ridiculous. He comes asking for help with a compilation problem, and you ask him to give you a complete compilable program?

  4. #4
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    Quote Originally Posted by Y2JRedDevil View Post
    This is ridiculous. He comes asking for help with a compilation problem, and you ask him to give you a complete compilable program?
    How is this ridiculous...the wanting to help...the wanting of more information to help...exactly how is this ridiculous...Gerard4143

  5. #5
    Just Joined!
    Join Date
    Feb 2009
    Posts
    45
    Quote Originally Posted by vardhasu
    Hi All

    Do not know if this the right forum, but I get the following
    undefined reference to `CPU_SET'

    though I have included <sched.h>
    To which Y2JRedDevil answered:
    Quote Originally Posted by Y2JRedDevil
    Yes, you need to compile with the flag -D_GNU_SOURCE,
    Seeing that
    Code:
    $> man CPU_SET
    […]
    SYNOPSIS
           #define _GNU_SOURCE
           #include <sched.h>
    […]
           void CPU_SET(int cpu, cpu_set_t *set);
    […]
    cleary states that the feature test macro «_GNU_SOURCE» must be defined, it seems you are not familiar with those. To avoid future mistakes of the same nature, I recommend reading the man page of feature test macros: Man page / 7 – feature_test_macros

  6. #6
    Just Joined!
    Join Date
    Mar 2009
    Posts
    2
    Quote Originally Posted by gerard4143 View Post
    How is this ridiculous...the wanting to help...the wanting of more information to help...exactly how is this ridiculous...Gerard4143
    - Hey, I've a compilation problem
    - Ok, give me a compilable example

    Help, ftw.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...