#171 getpid() declaration not included

closed-invalid
None
2002-08-11
2002-08-09
No

The following program should compile w/o any warnings
with -Wall. mingw 1.1 gives an "implicit declaration
of getpid()" warning. Including process.h fixes this,
but the first two listed header files should be
sufficient (see getpid() man page).

#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>

int main (void)
{
printf("pid is %d\n", getpid());
return 0;
}

Discussion

  • Danny Smith

    Danny Smith - 2002-08-09

    Logged In: YES
    user_id=11494

    MSDN says it is in process.h:

    http://msdn.microsoft.com/library/default.asp?
    url=/library/en-us/vccore98/html/_crt__getpid.asp

    Danny

     
  • Earnie Boyd

    Earnie Boyd - 2002-08-11

    Logged In: YES
    user_id=15438

    You forgot that MinGW is ANSI compatible only. The process.h is correct for the inclusion of getpid. Even the
    `#include <unistd.h>' should give an error but the MinGW team saw fit to include it as a simple courtesy. It simply
    includes the io.h file.

    Earnie

     
  • Earnie Boyd

    Earnie Boyd - 2002-08-11
    • assigned_to: nobody --> earnie
    • status: open --> closed-invalid