未定义的引用调用fork()code ::在Windows操作系统块编辑器 [英] Undefined reference to fork() in Code::Blocks editor in Windows OS

查看:1988
本文介绍了未定义的引用调用fork()code ::在Windows操作系统块编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在code :: Blocks的在Windows操作系统中运行低于code。
我用来获取所谓不确定的参考fork()的一个错误。
我没有设定/选择GCC编译器作为默认的编译器。

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;        
 ...     
 ....    
}

请帮帮我,告诉我,可以在code口右侧的Unix / Linux程序:: Blocks的在Windows环境下?

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);;
}

这给eroor未定义参考睡觉()和/ *延迟也* /。结果
请帮我。

Here it gives eroor that undefined reference to sleep() and / * delay also* /.
Please help me.

推荐答案

没有,你可以不写的Unix $ C $在Windows的C一样,不管你用什么IDE。但是,你应该尝试 cygwin的,并应提供您需要的兼容层。

No, you can't write Unix code on Windows like that, no matter what IDE you use. However, you should try cygwin, and that should provide the compatibility layer you need.

这篇关于未定义的引用调用fork()code ::在Windows操作系统块编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆