1

Following this question, I'm trying to use sysconf to get the number of processors on a Linux machine:

#include <unistd.h>

int main()
    {
         ...
         int CPUs = sysconf(_SC_NPROCESSORS_ONLN);
         ...
     }

However, the compiler gives me this error:

error: implicit declaration of function 'sysconf'

Am I doing something wrong? I tried to also add #include <sys/sysinfo.h> but nothing changed.

Jim
  • 63
  • 5

0 Answers0