[英]How can I express wait(NULL) without getting compilation warning?
If I compile my program with cc
then it works. 如果我用
cc
编译我的程序,那么它的工作原理。 But I must compile using gcc -pedantic -Wall -ansi -O4
. 但我必须使用
gcc -pedantic -Wall -ansi -O4
编译。 Then I get a warning for the statement wait(NULL)
然后我收到语句
wait(NULL)
的警告wait(NULL)
miniShell.c: In function ‘main’:
miniShell.c:84:13: warning: implicit declaration of function ‘wait’ [-Wimplicit-function-declaration]
wait(NULL);
^
Can I rewrite it to please the compiler? 我可以重写它以取悦编译器吗?
From the Linux Programmer's Manual : 从Linux程序员手册 :
WAIT(2) Linux Programmer's Manual WAIT(2)
NAME
wait, waitpid, waitid - wait for process to change state
SYNOPSIS
#include <sys/types.h>
#include <sys/wait.h>
pid_t wait(int *status);
So add those two #include
s to use wait()
. 所以添加这两个
#include
来使用wait()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.