title: Invalid use of incomplete type and forward declaration
body: <p>I was trying to resolve this issue but there must be some misunderstanding in how I undestand forward declaration.</p>
  
  <p>I am getting following error:</p>
  
  <pre><code>src/algorithm.cpp: In constructor ‘Algorithm::Algorithm(MainWindow*)’:
  src/algorithm.cpp:22:20: error: invalid use of incomplete type ‘struct Ui::MainWindow’
  src/mainwindow.h:23:10: error: forward declaration of ‘struct Ui::MainWindow’
  </code></pre>
  
  <p>I have these files (i ommited some lines and files and pasted only relevant code):</p>
  
  <p>algorithm.cpp</p>
  
  <pre><code>#include "algorithm.h"
  #include "mainwindow.h"
  
  Algorithm::Algorithm(MainWindow *mainWindow)
  {
     this-&gt;mainWindow = mainWindow;
  
     QAction *action = new QAction(this);
     action-&gt;setObjectName(QStringLiteral("action"));
     action-&gt;setText(this-&gt;getName());
  
     mainWindow-&gt;m_ui-&gt;menuAlgorithms-&gt;addAction(action);
  
     mainWindow-&gt;connect(action, SIGNAL(triggered()), this, SLOT(this-&gt;start()));
  }
  </code></pre>
  
  <p>algorithm.h</p>
  
  <pre><code>#ifndef ALGORITHM_H
  #define ALGORITHM_H
  
  #include &lt;QObject&gt;
  
  #include "graphwidget.h"
  #include "edge.h"
  #include "vertex.h"
  
  class MainWindow;
  
  class Algorithm : public QObject
  {
  public:
     MainWindow *mainWindow;
  
     Algorithm(MainWindow *mainWindow);
  
     void start();
     virtual void solve();
     virtual QString getDescription();
     virtual QString getName();
  };
  </code></pre>
  
  <p>mainwindow.cpp</p>
  
  <pre><code>#include "mainwindow.h"
  #include "algorithm.h"
  #include "../ui/ui_mainwindow.h"
  #include "vertex.h"
  #include "edge.h"
  #include "warning.h"
  
  mode_type mode;
  
  MainWindow::MainWindow(QWidget *parent) :
     QMainWindow(parent),
     m_ui(new Ui::MainWindow)
  {
     gundirected = NULL;
     gdirected = NULL;
  
     m_ui-&gt;setupUi(this);
  ...
  </code></pre>
  
  <p>mainwindow.h</p>
  
  <pre><code>#ifndef MAINWINDOW_H
  #define MAINWINDOW_H
  
  #include &lt;QMainWindow&gt;
  #include &lt;QSystemTrayIcon&gt;
  #include &lt;QSignalMapper&gt;
  #include &lt;QUndoView&gt;
  #include &lt;QGraphicsView&gt;
  #include &lt;QGraphicsScene&gt;
  #include &lt;QKeyEvent&gt;
  #include &lt;QGraphicsSceneMouseEvent&gt;
  #include &lt;QLabel&gt;
  #include &lt;QVBoxLayout&gt;
  #include &lt;QPushButton&gt;
  
  #include "graphwidget.h"
  
  enum mode_type {NORMAL, VERTEX, EDGE}; // vyctovy typ pro urceni editoacniho modu
  extern mode_type mode;
  
  namespace Ui
  {
     class MainWindow;
  }
  
  class MainWindow : public QMainWindow
  {
     Q_OBJECT
  
  public:
     explicit MainWindow(QWidget *parent = 0);
     ~MainWindow();
  
     Ui::MainWindow *m_ui;
  ...
  </code></pre>