[solved] Element, das vom Nicht-Klassenty

Du bist neu in der Welt von C++? Dann schau hier herein!
Antworten
tuner23
Beiträge: 1
Registriert: 22. Mai 2009 22:17

[solved] Element, das vom Nicht-Klassenty

Beitrag von tuner23 »

Hallo Community,

meine C++/Qt-Kenntnisse sind leider ziemlich eingerostet.

Dennoch will ich mich wieder einarbeiten, hänge jedoch schon am Anfang..

Ich will eine Konsole-Applikation erstellen. Folgenden Code habe ich bislang geschrieben:

mainloop:

Code: Alles auswählen

#include <QtCore/QCoreApplication>
#include <QTextStream>
#include "MGConsole/mgconsole.h"

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    MGConsole console();

    console.MGConsoleRun();
    //return a.exec();
}
mgconsole.h

Code: Alles auswählen

#ifndef MGCONSOLE_H
#define MGCONSOLE_H
#include <QString>
#include <QTextStream>
class MGConsole
{
public:
    MGConsole();

    //TODO: Rueckgabewert eigener Typ?
    bool MGConsoleRun();

private:
    // Varialbe
    bool consoleRun;
    QString prompt;
    //Functions

    //   bool MGConsoleRun(); //TODO: Rueckgabewert eigener Typ?
};

#endif // MGCONSOLE_H

mgconsole.cpp:

Code: Alles auswählen

#include "mgconsole.h"

MGConsole::MGConsole()
{
    consoleRun = true;
    prompt = "> ";

    QString input, output, error;

    QTextStream instream(stdin);
    QTextStream outstream(stdout);
    QTextStream errstream(stderr);


}

bool MGConsole::MGConsoleRun()
{
    outstream << prompt;
    return 1;
}
Das Ganze endet mit folgender Fehlermeldung:

Code: Alles auswählen

/usr/bin/make -w 
make: Entering directory `/local/essentials/svn/multiGraph/MGProjekt'
g++ -c -m64 -pipe -g -Wall -W -D_REENTRANT -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -I. -o main.o main.cpp
main.cpp: In function »int main(int, char**)«:
main.cpp:11: Fehler: Abfrage des Elementes »MGConsoleRun« in »console«, das vom Nicht-Klassentyp »MGConsole* ()()« ist
make: Leaving directory `/local/essentials/svn/multiGraph/MGProjekt'
make: *** [main.o] Fehler 1
Exited with code 2.
Error while building project MGProjekt
When executing build step 'Make'

Tjo, die Frage erübrigt sich: Wo liegt der Fehler?^^

PS: Gegen ein paar Tipps zu gutem Style hätte ich natürlich auch nichts einzuwenden.
Vor allem da das ganze soll eine grössere Console-Applikation (a la psql, bconsole, o.ä.) werden soll und später (nach ein paar 1000 Zeilen) OpenSource...

Dank im Voraus,
Toni.[/quote]
Zuletzt geändert von tuner23 am 15. Juni 2009 10:15, insgesamt 1-mal geändert.
upsala
Beiträge: 3946
Registriert: 5. Februar 2006 20:52
Wohnort: Landshut
Kontaktdaten:

Beitrag von upsala »

Hier:
MGConsole console();
Laß die Klammer weg.
Antworten