1. The custom class
* * Mwidget. H * * *
The class Mwidget: public QWidget
{
Public:
Structure, destructors, etc...
Void the open ();
}
* * Mwidget. CPP * *
Implementation:
Void Mwidget: : open () {}
2. The interface class: MwidgetInterface
* * MwidgetInterface. H * * *
` ` `
H # include Mwidget.
Mwidget * getMwidget ();
` ` `
3. The plug-in class
` ` `
H # include MwidgetInterface.
Mwidget * getMwidget ();
` ` `
4. In actual use in mainwindow
Mainwindow. H
` ` `
H # include MwidgetInterface.
` ` `
Mwidget were obtained through the plug-in class, because in the main window of the header file mainwindow. Introduces the plugin to h header file MwidgetInterface. J h, and plug-in header file introduces Mwidget. H, so Mwidget in the mainwindow calls the open method, can be introduced in QtCreator, but shown in compile
` ` `
Error: undefined reference to ` Mwidget: : open () ',
` ` `
This is what reason, should how to fix it?
CodePudding user response:
Hens, you should be on Qt section