Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implicit Declaration of Function in C UNIX

In the following code, I get a warning that there is an implicit declaration of function getpgid. I know its only a warning, but its for a class and the professor wants us to treat warnings as errors. So, help please.

I have included the appropriate header file as well so I have no idea whats wrong:

#include <unistd.h>

pid_t pid, pgid;

if ((pgid = getpgid(pid)) < 0) {
      app_error("Failure to get process group ID");
}
like image 727
DemonicImpact Avatar asked Feb 27 '23 01:02

DemonicImpact


1 Answers

From the man page:

Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

getpgid():
      _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
      || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
like image 50
vanza Avatar answered Mar 05 '23 17:03

vanza