Skip to content

error: ‘malloc’ was not declared in this scope

Translation: You are a bad person and did not include stdlib.h. Older versions of gcc let you get away with this. Not so with 4.3. I had similar errors for strcmp when not including string.h.

I got this trying to compile my thesis code on my laptop. The exact same code worked on my desktop, the difference being that my laptop is running intrepid, which uses gcc 4.3 by default. After blaming m12, I came across this and realized that it really was my fault.

Leave a Reply