This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

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

Hi,

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;
}
Parents Reply Children