C++之‘malloc’ was not declared in this scope和invalid conversion from ‘void*’ to ‘char*’ chenyu 2022-04-25 215 阅读1分钟 1、错误一 ‘malloc’ was not declared in this scope 2解决 加上头文件文件<stdlib.h> 3、错误二 invalid conversion from ‘void*’ to ‘char*’ 4、解决 在malloc函数前面加上强转类型(char *)