Slot
-
Am getting error after compiling.The code is as follows:
@#include <QtGui>#include "mainwindow.h"
#include "subWindow.h"int main(int argc , char *argv[])
{
QApplication app(argc,argv);mainwindow mWindow; mWindow.show(); subWindow window; window.show(); QObject::connect( &mWindow, SIGNAL(Clicked()), &window, SLOT(on_next_clicked())); return app.exec();
}
@the error is:
main.cpp: In function ‘int main(int, char**)’:
main.cpp:10: error: ‘mainwindow’ was not declared in this scope
main.cpp:10: error: expected ‘;’ before ‘mWindow’
main.cpp:11: error: ‘mWindow’ was not declared in this scope
make: *** [main.o] Error 1please help
-
[quote author="Revu" date="1298453513"]
main.cpp: In function ‘int main(int, char**)’:
main.cpp:10: error: ‘mainwindow’ was not declared in this scope
main.cpp:10: error: expected ‘;’ before ‘mWindow’
main.cpp:11: error: ‘mWindow’ was not declared in this scope
make: *** [main.o] Error 1please help[/quote]
Seems that you should read some C++ tutorial first. This are some basic error messages from the compiler. You must be familiar with header and implementation files before you can use Qt successfully.
And as Andre already mentioned, it's hard to analyze the error without the contents of mainwindow.h.
-
the code is as below:
@#ifdef MAINWINDOW_H
#define MAINWINDOW_H#include<QDialog>
#include"subWindow.h"
#include "ui_main.h"namespace Ui
{
class mainwindow;
}class mainwindow:public QDialog,public Ui::main
{
Q_OBJECTpublic:
explicit mainwindow(QWidget *parent=0);
~mainwindow();private slots:
void on_next_click();};
#endif@