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
#ifndef BANKFRAME_HPP
#define BANKFRAME_HPP
#include "All_Needed_Qt4_Headers.h"
/* This is the UIC compiled header with All the BankFrame UI widgets from the UI file. */
#include "BankFrameUI.hpp"
/* This is the MOC compiled header of the LoginFrame class, declared later here. */
#include "LoginFrame_moc.hpp"
class BankFrame
: public QFrame,
private Ui
::BankFrame{
private:
private slots:
on_createAccountBT_Pressed(void);
on_doLogonBT_Pressed(void);
public:
BankFrame(void)
{
QObject::connect(createAccBT,
SIGNAL(clicked
()),
this,
SLOT(on_createAccountBT_Pressed
()));
QObject::connect(doLogonBT,
SIGNAL(clicked
()),
this,
SLOT(on_doLogonBT_Pressed
()));
}
~BankFrame(){}
};
#endif
#ifndef BANKFRAME_HPP
#define BANKFRAME_HPP
#include "All_Needed_Qt4_Headers.h"
/* This is the UIC compiled header with All the BankFrame UI widgets from the UI file. */
#include "BankFrameUI.hpp"
/* This is the MOC compiled header of the LoginFrame class, declared later here. */
#include "LoginFrame_moc.hpp"
class BankFrame : public QFrame, private Ui::BankFrame
{
private:
private slots:
on_createAccountBT_Pressed(void);
on_doLogonBT_Pressed(void);
public:
BankFrame(void)
{
setupUi((QFrame*)this);
QObject::connect(createAccBT, SIGNAL(clicked()), this, SLOT(on_createAccountBT_Pressed()));
QObject::connect(doLogonBT, SIGNAL(clicked()), this, SLOT(on_doLogonBT_Pressed()));
}
~BankFrame(){}
};
#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.
#ifndef LOGINFRAME_HPP
#define LOGINFRAME_HPP
#include "All_Needed_Qt4_Headers_Again.h"
/* This is the UIC compiled header with All the LoginFrame widgets from the UI file. */
#include "LoginFrameUI.hpp"
class LoginFrame
: public QFrame,
private Ui
::LoginFrame{
private:
private slots:
void on_logonBT_Pressed(void);
public:
LoginFrame(void)
{
QObject::connect(logonBT,
SIGNAL(clicked
()),
this,
SLOT(on_logonBT_Pressed
()));
}
~LogonFrame(){}
};
#endif
#ifndef LOGINFRAME_HPP
#define LOGINFRAME_HPP
#include "All_Needed_Qt4_Headers_Again.h"
/* This is the UIC compiled header with All the LoginFrame widgets from the UI file. */
#include "LoginFrameUI.hpp"
class LoginFrame : public QFrame, private Ui::LoginFrame
{
private:
private slots:
void on_logonBT_Pressed(void);
public:
LoginFrame(void)
{
setupUi((QFrame*)this);
QObject::connect(logonBT, SIGNAL(clicked()), this, SLOT(on_logonBT_Pressed()));
}
~LogonFrame(){}
};
#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?
Bookmarks