bonjour, je suis entrain de voir ce qu'est l'héritage multiple en Qt, pour comprendre ce sujet j'ai commencé a faire une fenetre principale avec Qt designer, cependant , je ne comprend pas où est mon erreur de compilation.
Pouvez vous m'éclairez sur ce point?

Voici le code FenPrincipal.cpp :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
#include "FenPrincipal.h"
 
 
using namespace std;
 
FenPrincipal::FenPrincipal(QWidget *parent) : QMainWindow(parent)
{
	setupUi(this); 
}
Voici le code de FenPrincipal.h:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
#ifndef _FENPRINCIPAL_H_
#define _FENPRINCIPAL_H_
 
#include <QtGui>
#include "ui_FenPrincipal.h"
 
class FenPrincipal : public QMainWindow, private Ui::FenPrincipal
{
    Q_OBJECT
 
    public:
		FenPrincipal(QWidget *parent = 0);
 
    private slots:
 
	private:
 
};
 
#endif
Voici le code du main.cpp :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
#include <QApplication>
#include <QtGui>
#include "FenPrincipal.h"
 
 
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
 
	// Traducteur pour afficher les "cancel" en "annuler" par exemple
	QString locale = QLocale::system().name().section('_', 0, 0);
	QTranslator translator;
	translator.load(QString("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
	app.installTranslator(&translator);
 
    FenPrincipal fen;
    fen.show();
 
    return app.exec();
}
Voici mon erreur de compilation :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
In file included from FenPrincipal.cpp:1:
FenPrincipal.h:11: error: expected class-name before ‘{’ token
FenPrincipal.cpp: In constructor ‘FenPrincipal::FenPrincipal(QWidget*)’:
FenPrincipal.cpp:7: error: expected class-name before ‘{’ token
FenPrincipal.cpp:8: error: ‘setupUi’ was not declared in this scope
make: *** [FenPrincipal.o] Erreur 1
Merci de votre compréhension