unresolved external symbol "public: static struct QMetaObject const staticMetaObject"
-
@jsulm i detached it before and these are my files
mainw.h#ifndef MAINW_H #define MAINW_H #include <qmainwindow.h> #include "ui_mainw.h" #include "control.h" class Timer; class control; class Mainw : public QMainWindow { Q_OBJECT public: void start(); Mainw(Timer* time, QWidget* parent = nullptr); ~Mainw(); signals: void change_gui(); private: Ui::Main* ui; Timer* timer; private slots: void updatetime(); void toworkspace() { ui->pushButton->setDisabled(true); emit change_gui(); this->close(); } }; #endif // !MAINW_H
workspace.h
#ifndef WORKSPACE_H #define WORKSPACE_H #include <qprocess.h> #include <qmainwindow.h> #include "ui_workspace.h" #include "control.h" class Timer; class Workspace : public QWidget { Q_OBJECT public: Workspace(Timer* time, QWidget* parent = nullptr); ~Workspace(); void start(); signals: void change_gui(); private: //store all processes the ui run in a vector std::vector<QProcess*> processes; Ui::workspace* ui; Timer* timer; private slots: void updatetime(); void goback(); }; #endif // WORKSPACE_H
-
@jsulm said in unresolved external symbol "public: static struct QMetaObject const staticMetaObject":
more than one QObject based class in one header file
I don't want to derail this thread, but spoke to @Chris-Kawa a while ago and we both agree we have done this for years with no problems. Maybe we just don't do something "unusual/naughty/complicated".
-
@a_coder said in unresolved external symbol "public: static struct QMetaObject const staticMetaObject":
#include "control.h"
class Timer;
class control;You have a circular dependency: mainw.h includes control.h and control.h includes mainw.h. This is not going to work. Since you only use Timer* in mainw.h and already have a forward declaration for it, the control.h include is not needed, remove it.
-