我试图在C++中使用fork()
和wait()
系统调用。操作系统
我的代码非常简单。但是,我收到以下错误:
error C3861: 'fork': identifier not found
我已经包含以下头文件。我必须在这里包含其他标题吗?我做错了什么?
#include<stdafx.h>
#include <sys/types.h>
#include <signal.h>
int main(){
if(fork()==0)
{
printf("from child");
}
else
{
printf("from parent");
}
}
您使用的是什么操作系统?在Windows上,fork()不起作用。尝试使用cygwin。 – Alan 2011-04-02 03:03:08
http://stackoverflow.com/questions/15393218/error-c3861-tcsdup-identifier-not-found - 检查这里,如果这可以帮助你有点......! – 2015-01-14 11:06:57