title: error when using g++: 'malloc' was not declared in this scope
body: <p>I am practicing g++ to compile my code yet the error "malloc was not declared in this scope" keeps emerging at the beginning. The pieces of my code related to this error looks like:</p>
  
  <pre><code>/*------Basic.h--------*/
  using namespace std;
  
  /*------A.h------------*/
  class A{
   private:
    double* _data;
   public:
   A(int N);
  }
  
  /*------A.cpp----------*/
  A::A(int N){
    _data=(double*)malloc(N*sizeof(double));
  }
  </code></pre>
  
  <p>This problem never emerges when I use Microsoft Virtual Stdio. I therefore tried to add a line</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  </code></pre>
  
  <p>to Basic.h, and the error disappears. Now I am wondering why this kind of thing happens. Hasn't "namespace std" already include stdlib.h? Thanks a lot.</p>