g++ error: ‘malloc’ was not declared in this scope

Viewed 96190

I'm using g++ under Fedora to compile an openGL project, which has the line:

textureImage = (GLubyte**)malloc(sizeof(GLubyte*)*RESOURCE_LENGTH);

When compiling, g++ error says:

error: ‘malloc’ was not declared in this scope

Adding #include <cstdlib> doesn't fix the error.

My g++ version is: g++ (GCC) 4.4.5 20101112 (Red Hat 4.4.5-2)

3 Answers
Related