Getting an "overloaded member function not found in *"
Apr 30, 2013 at 12:19am UTC
I'm getting an error when I try to build the program. I'm trying to build a small Qt application, but I can't test what I've done so far because it won't compile.
Here is the calculator.cpp file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
#include "calculator.h"
#include <QLCDNumber>
#include <QString>
Calculator::Calculator(QWidget *parent) :
QWidget(parent), ui(new Ui::Calculator)
{
ans = 0;
currVal = 0;
setupUi(this );
}
QString Calculator::getNewVal(qint64 nextDig){
if (nextDig==0)
{
if (currVal > 0)
{
QString str = QString::number(currVal);
str.append("0" );
return str;
}
else
{
return "0" ;
}
}
else if (nextDig==1)
{
QString str = QString::number(currVal);
str.append("1" );
return str;
}
}
void Calculator::on_Zero_clicked()
{
ui->Display->display(getNewVal(0));
currVal = ui->Display->intValue();
}
void Calculator::on_One_clicked()
{
}
Here is the main.cpp file
1 2 3 4 5 6 7 8 9 10 11 12 13
#include "calculator.h"
#include <QApplication>
QString getNewVal(quint64 nextDig);
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Calculator w;
w.show();
return a.exec();
}
And here is the calculator.h file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#ifndef CALCULATOR_H
#define CALCULATOR_H
#include "ui_calculator.h"
class Calculator : public QWidget, private Ui::Calculator
{
Q_OBJECT
public :
Calculator(QWidget *parent = 0);
long long int ans;
long long int currVal;
private slots:
void on_Zero_clicked();
void on_One_clicked();
private :
Ui::Calculator *ui;
QString getNewVal(quint64);
};
#endif // CALCULATOR_H
Here is the error that the compiler is spitting at me:
"C:\Users\****\Documents\Qt Projects\SimpleCalculator\calculator.cpp:14: error: C2511: 'QString Calculator::getNewVal(qint64)' : overloaded member function not found in 'Calculator'"
I've searched online, but can't figure it out.
Topic archived. No new replies allowed.