Hallo!
Ich bin noch garnicht vertraut mit QT4 usw. oder C++. Lese mich nbisher nur durch Bücher.
Ich habe im Qt-Designer eine Oberfläche gebastelt. Diese will ich jetzt nur erstmal in ein Programm einbimnden. Ich will nur die App starten und die GUI sehen. Singnals n Slots mache usw mach ich später. Jedenfalls spuckt mir make schon Fehler aus:
/usr/bin/uic-qt4 migrator.ui -o ui_migrator.h
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I. -o migrator.o migrator.cpp
In file included from migrator.cpp:3:
migrator.h:9: error: expected class-name before ‘{’ token
migrator.cpp: In constructor ‘MainWindow::MainWindow(QWidget*)’:
migrator.cpp:8: error: ‘setupUi’ was not declared in this scope
make: *** [migrator.o] Fehler 1
Meine pro-Datei:
HEADERS = migrator.h
FORMS = migrator.ui
SOURCES = migrator.cpp \
main.cpp
# install
CONFIG += xdebug
TEMPLATE = app
TARGET = Migrator
DEPENDPATH += .
INCLUDEPATH += .
Meine main.cpp (obwohl die scheinbar durchläuft):
//main.cpp
#include <QApplication>
#include "migrator.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Migrator migrator;
migrator.show();
return app.exec();
}
Meine migrator.cpp:
#include <QtGui>
#include "migrator.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
setupUi(this);
setupActions();
}
Meine migrator.h:
#ifndef MIGRATOR_H
#define MIGRATOR_H
#include "ui_migrator.h"
#include <QApplication>
class MainWindow : public QMainWindow,
private Ui::MainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
protected:
void setupActions();
};
#endif //MIGRATOR.H
Ich wäre sehr dankbar für Hilfe.
Probleme beim Kompilieren mit einer ui-Datei
Code: Alles auswählen
class MainWindow : public QMainWindow,
private Ui::MainWindow