c - Why does my compiler not accept fork(), despite my inclusion of <unistd.h>? -


here's code (created test fork()):

#include <stdio.h>   #include <ctype.h> #include <limits.h> #include <string.h> #include <stdlib.h> #include <unistd.h>   int main() {        int pid;          pid=fork();      if (pid==0) {         printf("i child\n");         printf("my pid=%d\n", getpid());     }      return 0; } 

i following warnings:

warning: implicit declaration of function 'fork' undefined reference 'fork' 

what wrong it?

unistd.h , fork part of posix standard. aren't available on windows (text.exe in gcc command hints that's you're not on *nix).

it looks you're using gcc part of mingw, provide unistd.h header not implement functions fork. cygwin does provide implementations of functions fork.

however, since homework should have instructions on how obtain working environment.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -