une erreur quand j'ai ajouté les slot signals sur ma class Frm:
App.o: In function `Frm::Frm()':
App.cpp.text+0xdc): undefined reference to `vtable for Frm'
App.o: In function `Frm::Frm()':
App.cpp.text+0x16c): undefined reference to `vtable for Frm'
App.o: In function `Frm::~Frm()':
App.cpp.text+0xc27): undefined reference to `vtable for Frm'
App.o: In function `Frm::~Frm()':
App.cpp.text+0xca7): undefined reference to `vtable for Frm'
App.o: In function `Frm::~Frm()':
App.cpp.text+0xd17): undefined reference to `vtable for Frm'
collect2: ld a retourné 1 code d'état d'exécution
ces erreurs sont ils due à l'heritage de QObject?
voila je vous colle le code :
Frm.h
ainsi que le Frm.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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 #include <QtGui/QWidget> QT_BEGIN_NAMESPACE /*! * \class Frm * \brief wxWidgets Frame * \author Olivier Pilotte */ class Frm { Q_OBJECT public : /*! * \fn Frm( const wxString &, const wxPoint &, const wxSize & ); * \brief Constructor */ Frm(void ); /*! * \fn ~Frm * \brief Destructor */ ~Frm( void ); public slots: void setTextTxtFileSource(void); }; namespace Ui { class MainWindow: public Frm {}; } // namespace Ui QT_END_NAMESPACE #endif
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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 #include "../inc/Frm.h" #include <string> #include <iostream> using namespace std; Frm::Frm( void ) { } Frm::~Frm( void ) { } QObject::connect(btnFileSource, SIGNAL(clicked()), this, SLOT(setTextTxtFileSource())); //fileDialog->show(); retranslateUi(MainWindow); QObject::connect(btnFileQuit, SIGNAL(clicked()), MainWindow, SLOT(close())); QObject::connect(btnFolderQuit, SIGNAL(clicked()), MainWindow, SLOT(close())); thePanel->setCurrentIndex(1); QMetaObject::connectSlotsByName(MainWindow); } // setupUi void Frm::setTextTxtFileSource(void) { QFileDialog dialog; dialog.setFilter("TALL (*.*)"); QStringList file_names; if (dialog.exec() == QDialog::Accepted) { file_names = dialog.selectedFiles(); QString first_name = file_names[0]; txtFileSource->setText(first_name);} }
j'ai ajouté le code essentiel ou se trouve l'ereur ,j'ap pas collé les declarations des objets ... a cause de la lesibilité
Merci
Partager