1

I'm using a fairly old dev environment, when I "man sched_yield" I can see this man page, but if I try to use it,

$cat m.cpp

#include<sched_yield.h>
int main(){
    return 0;
}

g++ will say:

error: sched_yield.h: No such file or directory

So should I install any extra yum package on this box? How to fix it?

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Hind Forsum
  • 9,717
  • 13
  • 63
  • 119
  • 1
    The man page is likely for the `sched_yield` function. It should also mention what header you actually need to include. (`sched.h`?) – StoryTeller - Unslander Monica Sep 12 '18 at 10:33
  • 1
    IIRC rhel5 have it declared in `` and ``. – YSC Sep 12 '18 at 10:38
  • 1
    RHEL5 isn't updated at all any more (well okay there's ELS for another couple of years). Insert obligatory emphasis on the importance of upgrading when possible. I've been trying to get customers off RHEL6 for years. – Lightness Races in Orbit Sep 12 '18 at 10:43
  • Also see [How do I find packages with Yum?](https://unix.stackexchange.com/q/85715/56041) and [Searching for packages using apt-get](https://unix.stackexchange.com/q/111377/56041) on [Unix & Linux Stack Exchange](http://unix.stackexchange.com/). – jww Sep 12 '18 at 14:55
  • 1
    I usually `fgrep -rw` them in `/usr/include` :-) – bobah Sep 12 '18 at 17:11

1 Answers1

5

The manpage I'm looking at says #include <sched.h>.

It's the function that's called sched_yield.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055