【发布时间】:2014-04-22 08:40:52
【问题描述】:
我正在使用 linux c 中的克隆功能。
但是,当我尝试编译我的代码时,我遇到了错误 CLONE_VM undeclared (first use in this function)。
我去谷歌寻求解决方案,其中一个网站提到#include <sched.h> 必须包含在代码中。我已经在我的代码中包含了#include <sched.h>,但编译错误仍然存在。
有什么帮助吗? :)
int c = clone(child,p+STACKSIZE-1,CLONE_VM|SIGCHLD,NULL) ;
【问题讨论】:
-
不要使用
clone。使用标准的 pthread 库。clone系统调用主要用于 Posix 线程的实现者。