Why does my compiler not accept fork(), despite my inclusion of ?

前端 未结 4 1373
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 16:48

Here\'s my code (created just to test fork()):

#include   
#include 
#include 
#include 
#inclu         


        
4条回答
  •  失恋的感觉
    2020-12-01 17:09

    unistd.h and fork are part of the POSIX standard. They aren't available on windows (text.exe in your gcc command hints that's you're not on *nix).

    It looks like you're using gcc as part of MinGW, which does provide the unistd.h header but does not implement functions like fork. Cygwin does provide implementations of functions like fork.

    However, since this is homework you should already have instructions on how to obtain a working environment.

提交回复
热议问题