title: I am having problem with the error class undeclared in scope
body: <p>I am compiling these programs. Complex.h, Complex.cpp, and project1_task1.cpp on centOS I compile this fine in visual studio, but I get the error in centOS. this is for a class.</p>
  <p>Complex.h</p>
  <pre><code>#ifndef COMPLEX_H
  #define COMPLEX_H
  
  class Complex
  {
  private:
      double realPart;
      double imaginaryPart;
  public:
      Complex(double real = 0, double imag = 0); //constructor that initializes the complex number by default arguments
      double getReal(); //get function that returns the real part of the complex number
      double getImag(); //get function that returns the imaginary part of the complex number
      void setReal(double real); //set function that sets the real part of the complex number
      void setImag(double imag); //set function that sets the imaginary part of the complex number
      void print(); //function that displays the complex number
      
  };
  
  #endif
  </code></pre>
  <p>Complex.cpp</p>
  <pre><code>#include &lt;iostream&gt;
  #include &quot;Complex.h&quot;
  
  using namespace std;
  
  Complex::Complex(double real, double imag)
  {
      realPart = real;
      imaginaryPart = imag;
  }
  
  double Complex::getReal() {
      return this-&gt;realPart;
  }
  
  
  double Complex::getImag() {
      return this-&gt;imaginaryPart;
  }
  
  void Complex::setReal(double real) {
      realPart = real;
  }
  
  
  void Complex::setImag(double imag) {
      imaginaryPart = imag;
  }
  
  void Complex::print() {
      if (realPart != 0)
          cout &lt;&lt; realPart;
      if (imaginaryPart != 0)
      {
          if (imaginaryPart == 1)
              cout &lt;&lt; &quot;+i&quot;;
          else if (imaginaryPart == -1)
              cout &lt;&lt; &quot;-i&quot;;
          else if (imaginaryPart &gt; 0 &amp;&amp; realPart != 0)
              cout &lt;&lt; &quot; + &quot; &lt;&lt; imaginaryPart &lt;&lt; &quot;i&quot;;
          else
              cout &lt;&lt; imaginaryPart &lt;&lt; &quot;i&quot;;
      }
      cout &lt;&lt; endl;
  }
  </code></pre>
  <p>here is project1_task1.cpp</p>
  <pre><code>#include &lt;iostream&gt;
  #include&quot;complex.h&quot;
  
  using namespace std;
  
  int main()
  {
  
      Complex c;
      c.setReal(2);
      c.setImag(3);
      c.print();
  
      Complex c1(4);
      c1.setImag(5);
      c1.print();
  
      Complex c2(6, 7);
      c2.print();
  
      return 0;
  }
  </code></pre>
  <p>I keep getting Complex not defined in project1_task1.cpp when I compile in centOs.</p>
  <p>how can I fix this?</p>