ARM Gnu toolchain 13.2.Rel1 cstdlib include issue in cpp project build


I am facing cpp build issue when using stdlib malloc (build on windows). Despite the

#include <cstdlib>

is provided the cpp compiler returns this error when using malloc in the code:

error: 'malloc' was not declared in this scope
note: 'malloc' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
   16 | #include <cstdlib>
  +++ |+#include <cstdlib>

Reference code:
#include <cstdlib>
void *my_malloc(int size);
void *my_malloc(int size)
    void *p = malloc(size);
    return p;