title: C++ forbids declaration of ... with no type error while passing a struct to a function
body: <p>I can't figure out what I am doing wrong here.<br>
  I want to sort a list and have a compare function to sort it.<br>
  Found a code example where exactly my problem was solved but it doesn't work for me. </p>
  
  <p>I always get this error:<br>
  <strong>error: ISO C++ forbids declaration of ‘Cell’ with no type</strong>  </p>
  
  <p>Isn't <em>Cell</em> my type?  </p>
  
  <p>AStarPlanner.h</p>
  
  <pre><code>class AStarPlanner {
  
  public:
  
    AStarPlanner();
  
    virtual ~AStarPlanner();
  
  protected:
  
    bool compare(const Cell&amp; first, const Cell&amp; second);
  
    struct Cell {
  
          int x_;
          int y_;
          int f_;   // f = g + h
          int g_;   // g = cost so far
          int h_;   // h = predicted extra cost
  
          Cell(int x, int y, int g, int h) : x_(x), y_(y), g_(g), h_(h) {
                  f_ = g_ + h_;
          }
    };
  
  };
  </code></pre>
  
  <p>AStarPlanner.cpp  </p>
  
  <pre><code> bool AStarPlanner::compare(const Cell&amp; first, const Cell&amp; second)
   {
      if (first.f_ &lt; second.f_)
         return true;
      else
         return false;
   }
  </code></pre>