I have got a problem: I have 2 classes: mainwindow and ErgebnisAusFortran which look like this:
mainwindow.h:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QDebug>
#include <QString>
#include "ErgbnisAusFortran.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
public:
ErgbnisAusFortran Berechnung();
ErgbnisAusFortran Berechnung_1()
{
ErgbnisAusFortran ret;
qDebug() << " ich berechne Berechnung_1..." ;
return ret;
}
private slots:
void on_pb_Calculate_clicked();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
mainwindow.cpp:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "ErgbnisAusFortran.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pb_Calculate_clicked()
{
ErgbnisAusFortran Ergebnis_1;
ErgbnisAusFortran Ergebnis;
Ergebnis_1 = Berechnung_1();
Ergebnis = Berechnung();
}
ErgbnisAusFortran Berechnung()
{
ErgbnisAusFortran ret;
qDebug() << " ich berechne..." ;
return ret;
}
The thing that puzzles me is the following:
I have 2 methods Berechnung() and Berechnung_1().
Berechnung() is declared in mainwindow.h and defined in mainwindow.cpp
Berechnung_1() is declared in mainwindow.h and defined in mainwindow.h
When I run the program i get the following error concerning Berechnung():
undefined reference to MainWindow::Berechnung().Berechnung_1 works well. This puzzles me because I include mainwindow.h in mainwindow.cpp.
Does anybody know what is wrong?
thank you
itelly