Underfined reference to с qt виджетами: что делать?

Пишу прогу на qt. Пробую компилировать, *.o файлы создаются успешно, но на этапе линковки вылезает ошибка. Юзаю g++, конфигурированный make. Qt 5.14.0. Программа из нескольких файлов:

Main.cpp

#include <QtWidgets>
#include "toppanel.h"
int main(int argc, char** argv)
{
    QApplication app(argc,argv);
    QWidget wgt;
    wgt.setLayout(toppanel::toppanellayout);
    return app.exec();
}

Toppanel.cpp

#include <QtWidgets>
#include "toppanel.h"

toppanel::toppanel(){
    toppanelconfigure();
}
void toppanel::toppanelconfigure(){
    toppanel::toppanellayout = new QGridLayout();
    toppanel::toppanellayout->setContentsMargins(2, 3, 5, 5);
    toppanel::delebtn  = new QPushButton("Удалить");
    toppanel::cutbtn = new QPushButton("Вырезать");
    toppanel::copybtn  = new QPushButton("Копировать");
    toppanel::pastebtn  = new QPushButton("Вставить");
    toppanel::toppanellayout -> addWidget(cutbtn,0,0);
    toppanel::toppanellayout -> addWidget(copybtn,0,1);
    toppanel::toppanellayout -> addWidget(pastebtn,0,2);
    toppanel::toppanellayout -> addWidget(delebtn,0,1);
}

Toppanel.h

#include <QtWidgets>
#include <QObject>
#ifndef TOPPANEL_H
#define TOPPANEL_H
class toppanel: public QObject{
    Q_OBJECT
    private:
        QPushButton* cutbtn;
        QPushButton* copybtn;
        QPushButton* pastebtn;
        QPushButton* delebtn;
    
    public:
        static QGridLayout* toppanellayout;
        toppanel();
        void toppanelconfigure();

};
#endif

И, как я уже говорил, компиляция в *.o файлы проходит, но на этапе линковки падает:

main.o:main.cpp:(.rdata$.refptr._ZN8toppanel14toppanellayoutE[.refptr._ZN8toppanel14toppanellayoutE]+0x0): undefined reference to `toppanel::toppanellayout'
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [Makefile:73: audioeditior.exe] Error 1

И, да, забыл сказать, у меня в настоящий момент windows


Ответы (0 шт):