title: compiler says member function not defined however it is included in the header file c++
body: <p>Compiler says member function not defined however it is included in the header file c++. I have about 10 functions and one function find_similar the compiler says undeclared variable on the tester implementation file. The purpose of the program is to check the validity of two entries from the main.cpp/test file. I made a program which checks the entries from the test file.</p>
  <p>CarInventory.cpp</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstring&gt;
  #include &lt;iomanip&gt;
  #include &lt;string.h&gt;
  #include &quot;CarInventory.h&quot;
  using namespace std;
  using namespace sdds;
  
  
  
  void CarInventory::resetInfo()
  
  {
  
      m_type = nullptr;
  
      m_brand = nullptr;
  
      m_model = nullptr;
  
      m_year = 0;
  
      m_code = 0;
  
  
      m_price = 0;
  
  }
  
  CarInventory::CarInventory()
  
  {
  
      resetInfo();
  
  }
  
  CarInventory::CarInventory(const char* type, const char* brand, const char* model, int year, int code, double price)
  
  {
  
      resetInfo();
  
      setInfo(type, brand, model, year, code, price);
  
  }
  
  CarInventory::CarInventory(const char* type, const char* brand, const char* model)
  
  {
  
      resetInfo();
  
      setInfo(type, brand, model, 2022, 100, 1);
  
  }
  
  CarInventory::~CarInventory()
  
  {
  
      delete[] m_type;
  
      delete[] m_brand;
  
      delete[] m_model;
  
  }
  
  CarInventory&amp; CarInventory::setInfo(const char* type, const char* brand, const char* model, int year, int code, double price)
  
  {
  
      if (type == nullptr || brand == nullptr || model == nullptr || year &lt; 1990 || code &lt; 100 || price &lt; 0)
  
      {
  
          resetInfo();
  
      }
  
      else
  
      {
  
          delete[] m_type;
  
          delete[] m_brand;
  
          delete[] m_model;
  
          m_type = new char[strlen(type) + 1];
  
          strcpy_s(m_type, sizeof(type), type);
  
          m_brand = new char[strlen(brand) + 1];
  
          strcpy_s(m_brand, sizeof(brand),  brand);
  
          m_model = new char[strlen(model) + 1];
  
          strcpy_s(m_model, sizeof(m_model),  model);
  
          m_year = year;
  
          m_code = code;
  
          m_price = price;
  
      }
  
      return *this;
  
  }
  
  bool CarInventory::isValid() const
  
  {
  
      return m_type != nullptr &amp;&amp; m_brand != nullptr &amp;&amp; m_model != nullptr &amp;&amp; m_year &gt;= 1990 &amp;&amp; m_code &gt;= 100 &amp;&amp; m_price &gt;= 0;
  
  }
  
  bool sdds::CarInventory::find_similar(CarInventory car[], const int num_cars)
  {
      return false;
  }
  
  void CarInventory::printInfo() const
  
  {
  
      std::cout &lt;&lt; &quot;|&quot; &lt;&lt; std::setw(12) &lt;&lt; m_type &lt;&lt; &quot;|&quot; &lt;&lt; std::setw(18) &lt;&lt; m_brand &lt;&lt; &quot;|&quot; &lt;&lt; std::setw(18) &lt;&lt; m_model &lt;&lt; &quot;|&quot; &lt;&lt; std::setw(6) &lt;&lt; m_year &lt;&lt; &quot;|&quot; &lt;&lt; std::setw(6) &lt;&lt; m_code &lt;&lt; &quot;|&quot; &lt;&lt; std::setw(11) &lt;&lt; m_price &lt;&lt; &quot;|&quot; &lt;&lt; std::endl;
  
  }
  
  bool CarInventory::isSimilarTo(const CarInventory&amp; car) const
  
  {
  
      return m_type == car.m_type &amp;&amp; m_brand == car.m_brand &amp;&amp; m_model == car.m_model &amp;&amp; m_year == car.m_year;
  
  }
  
  namespace sdds {
  
      bool find_similar(CarInventory car[], const int num_cars)
  
      {
  
          for (int i = 0; i &lt; num_cars; i++)
  
          {
  
              for (int j = i + 1; j &lt; num_cars; j++)
  
              {
  
                  if (car[i].isSimilarTo(car[j]))
  
                  {
  
                      return true;
  
                  }
  
              }
  
          }
  
          return false;
  
  
      }
  }
  </code></pre>
  <p>Header File</p>
  <pre><code>#ifndef CARINVENTORY_H
  #define CARINVENTORY_H
  #define _CRT_SECURE_NO_WARNINGS
  
  namespace sdds {
  class CarInventory {
      char* m_type;
      char* m_brand;
      char* m_model;
      int m_year;
      int m_code;
      double m_price;
      void resetInfo();
  public:
      CarInventory();
      CarInventory(const char* type, const char* brand, const char* model, int year, int code, double price);
      CarInventory(const char* type, const char* brand, const char* model);
      bool isSimilarTo(const CarInventory&amp; car) const;
      ~CarInventory();
      CarInventory&amp; setInfo(const char* type, const char* brand, const char* model, int year, int code, double price);
      void printInfo() const;
      bool isValid() const;
      bool find_similar(CarInventory car[], const int num_cars);
  
     };
   }
   #endif
  </code></pre>
  <p>main/tester file</p>
  <pre><code>        #include&lt;iostream&gt;
          #include&lt;iomanip&gt;
          #include &quot;CarInventory.h&quot;
          using namespace std;
          using namespace sdds;
  
          int main()
           {
           const int num_cars = 6;
            bool invalid_data = false;
            CarInventory cars[num_cars] = {
         {},
      {&quot;suv&quot;, &quot;volvo&quot;, &quot;xc90&quot;},
      {&quot;Truck&quot;, &quot;Ford&quot;, &quot;F 150&quot;, 2021, 105, 55000},
      {&quot;Sedan&quot;, &quot;BMW&quot;, &quot;M550i&quot;, 2022, 101, 91000},
      {&quot;Truck&quot;, &quot;Tesla&quot;, &quot;Cybertruck&quot;, 2021, 102, 65000},
      {&quot;Sedan&quot;, &quot;BMW&quot;, &quot;M550i&quot;}
  };
  
  if (cars[2].setInfo(&quot;SUV&quot;, &quot;Volvo&quot;, &quot;XC90&quot;, 2019, 109, 80000).isValid()) {
      cout &lt;&lt; &quot;Information was set correctly!&quot; &lt;&lt; endl;
  }
  else {
      cout &lt;&lt; &quot;Information was set incorrectly!&quot; &lt;&lt; endl;
  }
  if (cars[1].setInfo(&quot;SUV&quot;, &quot;Volvo&quot;, &quot;XC90&quot;, 1234, 1, 1).isValid()) {
      cout &lt;&lt; &quot;Information was set correctly!&quot; &lt;&lt; endl;
  }
  else {
      cout &lt;&lt; &quot;Information was set incorrectly!&quot; &lt;&lt; endl;
  }
  
  
  cout &lt;&lt; setw(60) &lt;&lt; &quot;----- Car Inventory Information -----&quot; &lt;&lt; endl &lt;&lt; endl;;
  cout &lt;&lt; &quot;| Type       | Brand            | Model            | Year | Code |     Price |&quot; &lt;&lt; endl;
  cout &lt;&lt; &quot;+------------+------------------+------------------+------+------+-----------+&quot; &lt;&lt; endl;
  for (int i = 0; i &lt; num_cars; i++) {
      if (cars[i].isValid())
          cars[i].printInfo();
      else
          invalid_data = true;
  }
  
  if (invalid_data) {
      cout &lt;&lt; endl;
      cout &lt;&lt; setfill('*') &lt;&lt; setw(60) &lt;&lt; &quot;*&quot; &lt;&lt; endl;
      cout &lt;&lt; &quot;*  WARNING: There are invalid data in the inventory!      *&quot; &lt;&lt; endl;
      cout &lt;&lt; setfill('*') &lt;&lt; setw(60) &lt;&lt; &quot;*&quot; &lt;&lt; endl;
  }
  if (find_similar)(cars, num_cars)) {
      cout &lt;&lt; endl;
      cout &lt;&lt; setfill('+') &lt;&lt; setw(60) &lt;&lt; &quot;+&quot; &lt;&lt; endl;
      cout &lt;&lt; &quot;+  WARNING: There are similar entries in the inventory!   +&quot; &lt;&lt; endl;
      cout &lt;&lt; setfill('+') &lt;&lt; setw(60) &lt;&lt; &quot;+&quot; &lt;&lt; endl;
  }
  return 0;
    }
  </code></pre>
  <p>Error message:
  <a href="https://i.stack.imgur.com/ftilX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ftilX.png" alt="enter image description here" /></a></p>