Qt-Buch: undef. ref. to vtable for...
-
Der Destruktor muss virtual sein.
-
Hab ihn in der Basisklasse virtual gemacht, in der abgeleiteten "normal".
Ist doch richtig so, oder nicht?
Das Problem besteht aber irgendwie weiterhin?P.S.: Kann mir bitte mal jemand die Pfadvariablen und Befehle nennen?
-
So, jetzt kann ich auch wieder eingeloggt schreiben.
Also, wie erwähnt, sieht es bei der abgeleiteten Klasse jetzt so aus:
#ifndef GOTOCELLDIALOG_H #define GOTOCELLDIALOG_H #include <QDialog> #include "ui_gotocelldialog.h" class GoToCellDialog : public QDialog, public Ui::GoToCellDialog { Q_OBJECT public: GoToCellDialog(QWidget *parent = 0); ~GoToCellDialog() {}; private slots: void on_lineEdit_textChanged(); }; #endif
Die abgeleiteten Klassen sehen jetzt so aus (gekürzt, der Rest ist wie im ersten Beitrag):
class Ui_GoToCellDialog { public: Ui_GoToCellDialog() {}; virtual ~Ui_GoToCellDialog() {}; //(...) }; namespace Ui { class GoToCellDialog: public Ui_GoToCellDialog { public: GoToCellDialog() {}; virtual ~GoToCellDialog() {}; }; } // namespace Ui
Wie man sieht, habe ich zusätzlich noch default-Konstruktoren eingebaut. Von denen habe ich mir zwar nicht viel erhofft, aber was bessere fällt mir nicht ein...
-
Sinthoras@Bug schrieb:
So, jetzt kann ich auch wieder eingeloggt schreiben.
Zu früh gefreut... ich dachte, ich könnte wieder schreiben...
-
Oh, sry ich merke gerade, dass ich mich oben vertan hab:
Natürlich ist das erste die abgeleitete Klasse und das darunter ist die passende Basisklasse (mit ihrer Basisklasse wiederum).
-
Also, es geht jetzt, wenn auch auf etwas seltsame Art und Weise:
Zunächst mit der cmd.exe ins Verzeichniss und
qmake -project
ausführen.Dann die Qt Command Prompt öffnen, in das Verzeichnis wechseln und
qmake test.pro
makeFertig.
(Das qmake -project muss ich aber in der Windows-Eingabeauforderung ausführen, weil die Qt Command Prompt das aus irgendeinem Grund nicht peilt.)Naja, immerhin geht's jetzt.
-
Ich schätze, es liegt daran, dass Code::Blocks aus irgendeinem Grund moc nicht ausgeführt hat uns deshalb die Makros nicht aufgelöst wurden.
Wenn jemand eine Möglichkeit kennt, wie ich CB dazu bringen kann, dass es moc mit ausführt, wäre ich ihm natürlich sehr dankbar.
Vielen Dank,
Sinthoras
-
Such doch mal im offiziellen CB Forum, QT müsste von C::B schon länger unterstützt werden.
-
So, hab was entsprechendes gefunden.
Ich übernehme einfach mal den Text, nachzulesen hier:"I'm not sure if this is the best way, but I have a system I use that runs moc automatically so I don't have to do it manually. There could definitely be a better way, but this works well.
For each header that declares a class with the Q_OBJECT macro (any class that with signals or slots), I configure the project to compile with a custom build option of "moc header.h -o moc_header.cpp" and add moc_header.cpp to the project.
Here are the steps to do it using the nightly build of march 16/2007.
In the project management pane (the one that lists your project files) right click on the header file you want to set up.
Step 1:
Choose properties.
Go to the build tab
Make sure that "compile file" is checked but "link file" is not checked.
Go to the advanced tab
Make sure "choose custom command to build this file" is checked
In the text box, paste:
$(#QT)\bin\moc**.exe** header.h -o moc_header.cpp
(replace header.h and moc_header.cpp with the name of your own headers)
Click okayThis assumes you have the global variable qt correctly set and that your version of QT has moc in the bin subdirectory.
Step 2
Create a new file
Choose to add it to the project
Save it as moc_header.cpp.You'll never need to edit this file again, it is generated by moc, you just need to have it in the project and this is the easiest way."
Das ".exe" habe ich zum Originaltext ergänzt, weil es bei mir ohne Dateiendung nicht lief.
-
Sinthoras@Bug schrieb:
Ok, vielen Dank soweit für die Hilfe.
@andy1066: Wie muss ich den Qt-Pfad angeben. Einfach C:\Qt\4.2.3\ in die Path-Variable einzutragen hat nicht geholfen (oder ich habs irgendwie falsch gemacht).
C:\Qt\4.2.3\bin
Sinthoras@Bug schrieb:
Und in welcher Datei soll ich dann was ersetzen?
Was muss ich denn dann alles in der Konsole ausführen?qmake -project
qmake test.pro
make ???
und dann?cd ordner (zb c:\qt\test...)
qmake -project
qmake
make
dann musst du mal im unterordner relaese( oder so) schauen