背景:在 VS2019 中编译代码没有问题,在 XShell 中使用 g++ 对代码进行编译,报下列错误:no matching function for call to ‘wait::wait(NULL) 。中文翻译:对于 wait 没有匹配的函数调用
解决方法:在代码中引入 #include <sys/wait.h> 文件,再重新编译就不会报 error 了。因为 linux 新旧版本导致问题,一些报错在引用对应头文件后可解决
参考博客:
【C/C++】无法识别pid_t类型错误 error: unknown type name ‘pid_t’-CSDN博客
报错:error: unknown type name ‘pid_t’
引用 #include <sys/types.h>