C++ – Compiler error: memset was not declared in this scope

cgcc

I am trying to compile my C program in Ubuntu 9.10 (gcc 4.4.1).

I am getting this error:

Rect.cpp:344: error: ‘memset’ was not declared in this scope

But the problem is I have already included in my cpp file:

#include <stdio.h>
#include <stdlib.h>

And the same program compiles fine under Ubuntu 8.04 (gcc 4.2.4).

Please tell me what am I missing.

Best Answer

You should include <string.h> (or its C++ equivalent, <cstring>).