/home/lbg/fdsst_track/sImage.h:61: error: there are no arguments to 'malloc' that depend on a template parameter, so a declaration of 'malloc' must be available [-fpermissive]
data=(T*)malloc(sizeof(T)*w*h);
^
/home/lbg/fdsst_track/sImage.h:241: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive]
free(arr_x2);
^
原因:还是没有加头文件:
#include<stdlib.h>
本文介绍了解决在C/C++中使用malloc和free函数时遇到的编译错误的方法。错误出现在未正确包含必要的头文件导致的问题。通过加入正确的头文件#include <stdlib.h>,可以确保内存分配和释放函数在编译时被正确识别。
1万+

被折叠的 条评论
为什么被折叠?



