title: How to solve the multiple definition in Qt?
body: <p>I don´t know why I got this problem, the header files are just included once but it continuous showing the error, I also already check the .pro file and every SOURCE is just included once. How can I solve this? 
  I will attach the files I'm using and their include and the code of the little ones</p>
  
  <p>globals.h</p>
  
  <pre><code>#ifndef GLOBALS_H
  #define GLOBALS_H
  
  #include &lt;QtGlobal&gt;
  #include "structs.h"
  
  QT_BEGIN_NAMESPACE
  
  struct ListaPaquetes;
  
  QT_END_NAMESPACE
  
  extern ListaPaquetes *nuevoPaquete;
  
  #endif // GLOBALS_H
  </code></pre>
  
  <p>mainwindow.h</p>
  
  <pre><code>#ifndef MAINWINDOW_H
  #define MAINWINDOW_H
  
  #include &lt;QMainWindow&gt;
  #include &lt;QtGui&gt;
  #include &lt;QDialog&gt;
  #include &lt;QtCore&gt;
  
  namespace Ui {
  class MainWindow;
  }
  
  class MainWindow : public QMainWindow
  {
      Q_OBJECT
  
  public:
      explicit MainWindow(QWidget *parent = 0);
      ~MainWindow();
  
  private slots:
      void on_startButton_clicked();
  
      void on_planificarProduButton_clicked();
  
  private:
      Ui::MainWindow *ui;
  };
  
  #endif // MAINWINDOW_H
  </code></pre>
  
  <p>produccion.h (only the first lines)</p>
  
  <pre><code>#ifndef PRODUCCION_H
  #define PRODUCCION_H
  
  #include &lt;QDialog&gt;
  </code></pre>
  
  <p>structs.h (onyl first lines)
  Here is the struct ListaPaquetes, which is the responsible of the error, so the problem I guess is with this file but I don't know why</p>
  
  <pre><code>#ifndef STRUCT_H
  #define STRUCT_H
  
  #include &lt;QString&gt;
  #include &lt;QList&gt;
  
  struct Nodo
  {
      int cantidad;
      QString tipoPaquete;
      Nodo *siguiente;
      Nodo *anterior;
  
      Nodo(){}
  
      Nodo (int cant, QString paquete)
      {
          cantidad = cant;
          tipoPaquete = paquete;
          siguiente = nullptr;
          anterior = nullptr;
      }
  };
  
  struct ListaPaquetes
  {
      Nodo *pn;
  
      ListaPaquetes()
      {
          pn = nullptr;
      }
  
      void crearPaquete(int,QString);
      QList&lt;QString&gt; paquetesAgregados();
  
  };
  
  void ListaPaquetes::crearPaquete(int cant, QString paquete)
  {
      if (pn==nullptr)
      {
          pn = new Nodo(cant, paquete);
          pn-&gt;siguiente = pn;
          pn-&gt;anterior = pn;
      }
      else
      {
          Nodo *nuevo = new Nodo(cant, paquete);
          pn-&gt;anterior-&gt;siguiente=nuevo;
          nuevo-&gt;anterior = pn-&gt;anterior;
          nuevo-&gt;siguiente=pn;
          pn-&gt;anterior = nuevo;
      }
  }
  
  QList&lt;QString&gt; ListaPaquetes::paquetesAgregados()
  {
      QList &lt;QString&gt; paquetes;
      if (pn!=nullptr)
      {
          Nodo *tmp = pn;
          do
          {
              paquetes.append(tmp-&gt;tipoPaquete);
              tmp = tmp-&gt;siguiente;
          }while(tmp!=pn);
      }
      return paquetes;
  }
  
  #endif // STRUCT_H
  </code></pre>
  
  <p>globals.cpp</p>
  
  <pre><code>#include "globals.h"
  
  ListaPaquetes *nuevoPaquete = new ListaPaquetes();
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>#include "mainwindow.h"
  #include &lt;QApplication&gt;
  
  int main(int argc, char *argv[])
  {
      QApplication a(argc, argv);
      MainWindow w;
      w.show();
  
      return a.exec();
  }
  </code></pre>
  
  <p>mainwindow.cpp</p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  #include &lt;QColor&gt;
  #include &lt;QColormap&gt;
  #include &lt;QtCore&gt;
  #include &lt;QtGui&gt;
  #include &lt;QMessageBox&gt;
  #include "produccion.h"
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
  
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  void MainWindow::on_startButton_clicked()
  {
      if(ui-&gt;cantGalletas-&gt;text() == "")
      {
          QMessageBox::warning(this,"Error","Debe introducir una cantidad de 
          galletas");
      }
  
  }
  
  void MainWindow::on_planificarProduButton_clicked()
  {
      Produccion *ventanaPaquetes = new Produccion();
      ventanaPaquetes-&gt;show();
  }
  </code></pre>
  
  <p>produccion.cpp (When I run something from here, it shows the error)</p>
  
  <pre><code>#include "produccion.h"
  #include "ui_produccion.h"
  #include &lt;QtCore&gt;
  #include &lt;QMessageBox&gt;
  #include "globals.h"
  </code></pre>
  
  <p>Here are the errors:</p>
  
  <p><img src="https://i.stack.imgur.com/f1dkZ.png" alt="enter image description here"></p>