Ah ben tiens, voilà ce qui se passe :
Suite à quelques modifs, j'ai maintenant ça :
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
Ui::MainWindow *ui;
A noter que je comprends pas à quoi sert ce namespace. Je vais lire de la dic à ce sujet, mais c'est vraiment pas le truc qui me saute aux yeux :/
J'ai ensuite ce header :
#ifndef MWUI_H
#define MWUI_H
#include "mainwindow.h"
extern Ui::MainWindow* mwui;
#endif // MWUI_H
Dans main.cpp :
#include <QtGui/QApplication>
#include "mainwindow.h"
#include "mwui.h"
Ui::MainWindow* mwui;
int main(int argc, char* argv [])
{
QApplication a (argc, argv);
MainWindow w;
mwui = w.ui;
w.show ();
return a.exec ();
}
Et enfin, dans l'implémentation d'une classe perso :
#include "mwui.h"
[...]
Connexion::Connexion (DialogNewConnexion* dnc)
{
[...]
mwui->tabList->addTab (serverpage, this->ConnexionInfos.Servername);
}
Et là, double erreur :
- dans le .cpp : /mnt/Data/Programmation/PC/Programmes/
<software name protected by the NSA>/Debug/../
<software name protected by the NSA>/connexion.cpp:30: error: invalid use of incomplete type 'struct Ui::MainWindow'
- dans le .h qui me sert à la variable globale : /mnt/Data/Programmation/PC/Programmes/
<software name protected by the NSA>/Debug/../
<software name protected by the NSA>/mainwindow.h:9: error: forward declaration of 'struct Ui::MainWindow'
Pourquoi je me prends ces erreurs ?