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();
}
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;
}
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]