gcc 编译 c 语言报错:warning implicit declaration of function ‘system’

1)、报错信息

1
2
3
4
5
------------------------gcc main.c -o main ; ./main
main.c: In function ‘container_main’:
main.c:22:2: warning: implicit declaration of function ‘system’ [-Wimplicit-function-declaration]
22 | system("mount -t proc proc /proc");
| ^~~~~~

2)、解决方案
在文件头加入#include <stdlib.h>