Hello partners,

I´m having a lot of redefinition erros from MinGW when i try to compile two QObject subclasses named LoginFrame and BankFrame.

Code above:


BankFrame.hpp - "Main Window" (but QFrame) Class
Qt Code:
  1. #ifndef BANKFRAME_HPP
  2. #define BANKFRAME_HPP
  3.  
  4. #include "All_Needed_Qt4_Headers.h"
  5.  
  6. /* This is the UIC compiled header with All the BankFrame UI widgets from the UI file. */
  7. #include "BankFrameUI.hpp"
  8.  
  9. /* This is the MOC compiled header of the LoginFrame class, declared later here. */
  10. #include "LoginFrame_moc.hpp"
  11.  
  12. class BankFrame : public QFrame, private Ui::BankFrame
  13. {
  14. private:
  15.  
  16. private slots:
  17.  
  18. on_createAccountBT_Pressed(void);
  19. on_doLogonBT_Pressed(void);
  20.  
  21. public:
  22.  
  23. BankFrame(void)
  24. {
  25. setupUi((QFrame*)this);
  26. QObject::connect(createAccBT, SIGNAL(clicked()), this, SLOT(on_createAccountBT_Pressed()));
  27. QObject::connect(doLogonBT, SIGNAL(clicked()), this, SLOT(on_doLogonBT_Pressed()));
  28. }
  29.  
  30. ~BankFrame(){}
  31. };
  32.  
  33. #endif
To copy to clipboard, switch view to plain text mode 


Now, the problematic class, LoginFrame.hpp - The class used by BankFrame to show a window to do Logon in a Bank System.
Qt Code:
  1. #ifndef LOGINFRAME_HPP
  2. #define LOGINFRAME_HPP
  3.  
  4. #include "All_Needed_Qt4_Headers_Again.h"
  5.  
  6. /* This is the UIC compiled header with All the LoginFrame widgets from the UI file. */
  7. #include "LoginFrameUI.hpp"
  8.  
  9. class LoginFrame : public QFrame, private Ui::LoginFrame
  10. {
  11. private:
  12.  
  13. private slots:
  14.  
  15. void on_logonBT_Pressed(void);
  16.  
  17. public:
  18.  
  19. LoginFrame(void)
  20. {
  21. setupUi((QFrame*)this);
  22. QObject::connect(logonBT, SIGNAL(clicked()), this, SLOT(on_logonBT_Pressed()));
  23. }
  24.  
  25. ~LogonFrame(){}
  26. };
  27.  
  28. #endif
To copy to clipboard, switch view to plain text mode 


Yes, the slots are implemented (but empty for now) in the .CPP files.
I tried to use the BankFrame in main() to test the layout, and i got
a lot of meta object functions redefinition errors like this:

- error: multiple definition of LoginFrame::qt_metacast(const char*)
- error: multiple definition of LoginFrame::qt_metacall(QObject* ...
- error: multiple definition of LoginFrame::qt_static_metacall(QObject* ...
- error: multiple definition of LoginFrame::metaObject() const

Note: I´m using CodeBlocks 10.15 , MinGW 4.6 and Qt 4.8.1


Someone could tell me what´s the problem?