编译时出现这个错误: error: 'NULL' was not declared in this scope 解决方式: 在文件开头添加如下代码: #include <stddef.h> 或者 #include <stdlib.h> 或者 #include <cstdlib>