- I have a Qt project
- Got this error in file “lab2.h” next to the line with the include directive (signed next to it)
#ifndef LAB2_H
#define LAB2_H
#include <QWidget>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QPlainTextEdit>
#include <QFrame>
#include "element.h" //too few arguments provided to function-like macro invocation element.h:24:25note: error occurred here:Qt6.7.0mingw_64include...
class lab2 : public QWidget
{
Q_OBJECT
protected:
QFrame *f;
QLabel *label;
QLineEdit *edit;
QPlainTextEdit *box;
QPushButton *add;
QPushButton *del;
QPushButton *first;
QPushButton *last;
QPushButton *all;
QPushButton *exit;
QPushButton *sum;
lists my_list;
element *q;
public:
lab2(QWidget *parent = nullptr);
~lab2();
public slots:
void beg();
void fi();
void de();
void la();
void lla();
void S();
};
class numi: public element{
public:
int i;
numi(int n):element(){
i=n;
}
std::string show()override{
std::string ret="";
ret+=std::to_string(i);
return ret;
}
~numi() override{}
};
class numf: public element{
public:
double f;
numf(double m): element(){f=m;}
std::string show()override{
std::string ret="";
ret+=std::to_string(f);
return ret;
}
~numf()override{}
};
#endif // LAB2_H
- from file “element.h” with description of classes
#ifndef ELEMENT_H
#define ELEMENT_H
#include <string>
class element
{
public:
element *p;
element(){p=nullptr;};
virtual ~element(){}
virtual std::string show()=0;
};
class lists{
private:
element *f,*l,*c;
public:
lists();
void add(element *q);
~lists();
void del();
std::string foreach();
std::string sym();
element *fist();
element *last();
};
class E{
public:
int e;
E(int ae);
std::string error();
};
#endif // ELEMENT_H
I realized after looking for similar problems that I had lost my arguments somewhere. I don’t quite understand where to look for the error
New contributor
МАРГОША ТВ is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1