Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22148

Undefined reference to fork() in Code::Blocks editor in Windows OS

$
0
0

When I am running below code in Code::Blocks in Windows OS.I used to get an error called undefined reference to fork().I did set/choose GCC compiler as my default compiler.

#include<stdio.h>       #include<unistd.h>          void main()          {        int x;        x = 0;        fork();        x = 1;         ...      ....    }

Please help me and tell me, can I right unix/linux programs in Code::Blocks in windows environment?

And I write another program,

main(){  int x = 0;  if(x == 0)  {    printf("X = %d", x);    sleep(1000);//used delay also    x = 1;    printf("Now X = %d", x);;  }}

Here it gives error that undefined reference to sleep() and / * delay also* /.


Viewing all articles
Browse latest Browse all 22148

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>